Skip to content

Discussion: Naming of envs #1527

Description

@gabrielschulhof

Following up on our discussion during the meeting, let's jot down the possible names we'd like to use instead of env and nogc_env. Here are the scenarios I can think of so far:

napi_statusnapi_get_instance_data(_____env, void**data); // currently node_api_nogc_envvoidmy_sync_finalizer(_____env, void*data, void*hint); // currently node_api_nogc_envvoidmy_regular_finalizer(_____env, void*data, void*hint); // currently napi_envtypedefvoid (*_____)(_____env, void*data, void*hint); // currently napi_finalizertypedefvoid (*_____)(_____env, void*data, void*hint); // currently node_api_nogc_finalizernapi_statusnapi_create_object(_____env, napi_value*result); // currently napi_env

Inspired my Michael's emphasis that we're dealing with a base class - subclass relationship, I was thinking,

napi_statusnapi_get_instance_data(node_api_basic_envenv, void**data);
voidmy_sync_finalizer(node_api_basic_envenv, void*data, void*hint);
voidmy_regular_finalizer(napi_envenv, void*data, void*hint);
typedefvoid (*napi_finalizer)(napi_envenv, void*data, void*hint);
typedefvoid (*node_api_basic_finalizer)(node_api_basic_env, void*data, void*hint);
napi_statusnapi_create_object(napi_envenv, napi_value*result);

since basic conveys the idea that fewer things can be done when you only have a "basic" environment, and since folks might be familiar with the base class/subclass relationship, whereby if a function accepts a base class then one can pass either, whereas if the function accepts a subclass and one only has a base class handy, then the function is off-limits.

We also need not necessarily elaborate on why an environment is basic. The fact that the context of being in a sync finalizer and therefore unable to manipulate engine heap is the reason why some APIs are off-limits is something we can document, but not absolutely necessarily.

WDYT?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions