Skip to content

RFC: removal of JSRuntime #421

@bellard

Description

@bellard

The existence of JSRuntime and JSContext complicates the QuickJS API because many functions are duplicated and sometimes it is not clear whether a JSRuntime or JSContext parameter is required. The rationale is that JSContext represent the JS Realm and JSRuntime the whole JS execution content. In many applications, having more than one Realm is not needed. Even when several realms are needed, it should be enough to have a current realm stored in the execution context and an API to change it.

So I propose to remove the JSRuntime type and to add a new JSRealm type. JSContext would become the JS execution context. New functions would be added to change the current realm and to create or destroy a realm. All the functions with a RT suffix would be removed.

If necessary, backward compatibility could be mostly kept by setting JSRuntime = JSContext and by redirecting the functions with a RT suffix to the corresponding functions without a RT suffix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions