Skip to content

Diversity of Realms / Why do we need incumbent settings object for the callbacks #7903

Closed
@dSalieri

Description

@dSalieri

I didn't know how to better make my title, ok let it be so it is.

Not so long ago I looked into the whatwg specification in order to find out the specific algorithms of the host procedures referred to by ecma262. And some steps in these algorithms have misled me.

For example, there are such concepts as entry, incumbent, current and relevant. There is an example that demonstrates these terms. Moreover, there is even a description of these concepts, but to be honest they do not explain, but only add even more confusion. It is difficult to understand the difference clearly between incumbent, current and relevant.

In the ecma262 specification, it is clearly stated about the current Realm that it is a Realm component of the running execution context (everything is clear).

  • What is the incumbent Realm?
  • And what is the relevant Realm?

We need a clear border that can show their difference.

If possible, it would be nice to show the difference of these terms with a different number of Realms to see when the incumbent Realm === current Realm, for example. And when incumbent Realm !== current Realm. According to the whatwg specification, this is difficult to understand.


If we consider the algorithms that interested me, I didn't quite understand how the incumbent setting object affects the callback functions that will be called as micro-tasks. There is even a section of Promise on mdn describing this object, but its meaning has not been disclosed, so far, its impact on the document on Realm is unclear. What prevents us from calling this function from then just with an active context object without an incumbent setting object (I'm speaking about field: [[HostDefined]]: { [[IncumbentSettings]] } in the HostMakeJobCallback)

It's about algorithms:

For the first one, gets incumbent setting object and when time comes to return value it places that incumbent object into JobCallback Record.
For the second one, uses incumbent setting object for the preparation of run a callback

So I can't to understand what is incumbent, I don't understand its affection for calling callback functions. Could you clarify this thing?


In conclusion, it is not recommended to use the entry and incumbent concept in the specification itself.

The incumbent and entry concepts should not be used by new specifications, as they are excessively complicated and unintuitive to work with. We are working to remove almost all existing uses from the platform: see issue #1430 for incumbent, and issue #1431 for entry.

Then why is this concept used in relation to callback functions from promises and Web IDL?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions