Extra Execution Context of the module
I am confused, I've checked a several editions on how ECMAScript operating with Execution Contexts.
In 9.0 / 10.0
- ModuleDeclarationEnvironmentSetup / InitializeEnvironment doesn't create Execution Context, also doesn't do it active execution context
- ModuleExecution / ExecuteModule creates Execution Context and does its active until ECMAScript code is evaluating
In 11.0
- InitializeEnvironment creates new ECMAScript Execution Context and makes its active until bindings writing into Environment Record.
- ExecuteModule pull from module.[[Context]] Execution Context and make its active until [[ECMAScriptCode]] of module evaluating.
In 14.0 / current draft
- InitializeEnvironment creates new ECMAScript Execution Context and makes its active until bindings writing into Environment Record.
- ExecutionModule creates new ECMAScript Execution Context and make its active until [[ECMAScriptCode]] of module evaluating
So I have several questions:
- In 11.0 of spec suddenly use Execution Context and moreover makes it active in InitializeEnvironment operation. But what is the reason for that?
- In 14 / draft - "jobs went weird", I mean [[Context]] of module isn't used as it was in 11.0 into ExecutionModule. Instead of that in ExecutionModule (draft) creates the brand new Execution Context and I definitely don't understand it, because I don't see tie between InitializeEnvironment and ExecutionModule how it was in 9.0 / 10.0. Any clarifications?
It's very unclear what you're asking, but either way I think es.discourse.group might be the place you're looking for?
@ljharb updated my issue
If you want to know the history of changes to a repository, git blame is your friend (or for this repo you can use searchfox, linked from the readme). Have you tried that?
@bakkot thanks, I've invesigated my questions owing to your tips ;)
Answer to my questions:
- If we don't create Execution Context, we will get null in [[ScriptOrModule]] of FunctionDeclaration (if we define FunctionDeclaration in module) https://github.com/tc39/ecma262/pull/1670
- Conflict of merging https://github.com/tc39/ecma262/issues/2660
Anyway, problem from point 2 is still opened and current draft has weird Execution Context instead of using [[Context]] field.
PR #2886 fixes issue #2660.
PR #2886 fixes issue #2660.
@jmdyck I see, but draft hasn't this fix yet.