Skip to content

[js-api] Possible alignment of abstract closure conventions with ECMA-262 #2027

@ShinWonho

Description

@ShinWonho

In the JS-API specification, there are a few cases where abstract closures are used.
I was wondering if these could follow the same conventions as in ECMA-262 for consistency.

Image

React step in js-api specification

For example, in the algorithm “Instantiate a promise of a module”, there is a step called react.
This step takes as input some substeps to perform when the promise is fulfilled or rejected.
Each of these substeps is later passed to ECMA-262’s CreateBuiltinFunction, which expects an abstract closure as an argument.
In other words, the react step treats those substeps as abstract closures in the ECMA-262 sense.

However, the way these closures are represented in the JS-API specification looks quite different from the convention used in ECMA-262.

Image

Abstract closure in ECMA-262

Image

Abstract closure in WebIDL

In ECMA-262, abstract closures are explicitly marked as such, with their parameters and captured variables listed.
While the JS-API specification depends on the Infra Standard (which may justify stylistic differences), another Infra-based specification, WebIDL, also follows the ECMA-262 convention.

Would it make sense for the JS-API specification to adopt a similar notation, explicitly marking these substeps as abstract closures like below?
This could make it clearer that they correspond to ECMA-262 abstract closures and help maintain consistency across related specifications.
For example, it might be written as follows instead:

Image

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