-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layering: Enable cyclic dependencies with non-STMR module types #1311
Conversation
<emu-alg> | ||
1. For each ExportEntry Record _e_ in _module_.[[IndirectExportEntries]], do | ||
1. Let _resolution_ be ? _module_.ResolveExport(_e_.[[ExportName]], « »). | ||
1. 1. _module_ be this Source Text Module Record. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"1." -> "Let"
@@ -21337,8 +21337,7 @@ <h1>Static Semantics: VarScopedDeclarations</h1> | |||
<emu-clause id="sec-abstract-module-records"> | |||
<h1>Abstract Module Records</h1> | |||
<p>A <dfn>Module Record</dfn> encapsulates structural information about the imports and exports of a single module. This information is used to link the imports and exports of sets of connected modules. A Module Record includes four fields that are only used when evaluating a module.</p> | |||
<p>For specification purposes Module Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Module Record is an abstract class with concrete subclasses. This specification only defines a single Module Record concrete subclass named Source Text Module Record. Other specifications and implementations may define additional Module Record subclasses corresponding to alternative module definition facilities that they defined.</p> | |||
<p>Module Record defines the fields listed in <emu-xref href="#table-36"></emu-xref>. All Module Definition subclasses include at least those fields. Module Record also defines the abstract method list in <emu-xref href="#table-37"></emu-xref>. All Module definition subclasses must provide concrete implementations of these abstract methods.</p> | |||
<p>For specification purposes Module Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Module Record is an abstract class with both abstract and concrete subclasses. This specification defines the abstract subclass named Cyclic Module Record and its concrete subclass named Source Text Module Record. Other specifications and implementations may define additional Module Record subclasses corresponding to alternative module definition facilities that they defined.</p> <p>Module Record defines the fields listed in <emu-xref href="#table-36"></emu-xref>. All Module Definition subclasses include at least those fields. Module Record also defines the abstract method list in <emu-xref href="#table-37"></emu-xref>. All Module definition subclasses must provide concrete implementations of these abstract methods.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a linebreak after the first </p>
.
<emu-clause id="sec-moduledeclarationinstantiation"> | ||
<h1>Instantiate ( ) Concrete Method</h1> | ||
<emu-clause id="sec-moduledeclarationenvironmentsetup" aoid="ModuleDeclarationEnvironmentSetup"> | ||
<h1>ModuleDeclarationEnvironmentSetup ( )</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clause header should end with "Concrete Method".
</emu-clause> | ||
|
||
<emu-clause id="sec-moduleexecution" aoid="ModuleExecution"> | ||
<h1>ModuleExecution ( )</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clause header should end with "Concrete Method".
|
||
<p>The Instantiate concrete method of a Source Text Module Record implements the corresponding Module Record abstract method.</p> | ||
<p>On success, Instantiate transitions this module's [[Status]] from `"uninstantiated"` to `"instantiated"`. On failure, an exception is thrown and this module's [[Status]] remains `"uninstantiated"`.</p> | ||
<p>The ModuleDeclarationEnvironmentSetup concrete method implements the corresponding Cyclic Module Record abstract method.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After "concrete method", insert "of a Source Text Module Record".
|
||
<p>The Evaluate concrete method of a Source Text Module Record implements the corresponding Module Record abstract method.</p> | ||
<p>Evaluate transitions this module's [[Status]] from `"instantiated"` to `"evaluated"`.</p> | ||
<p>The ModuleExecution concrete method implements the corresponding Cyclic Module Record abstract method.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After "concrete method", insert "of a Source Text Module Record".
This PR LGTM, modulo the nits from @jmdyck. Let's discuss this at the November 2018 TC39 meeting. |
PR to address the issues noted above: linclark#1 |
BTW, as this is a layering change (and not normative), and all concerns raised have been addressed, do we need to discuss it in a TC39 meeting, or can it be merged without that? Asking just to know whether I should prepare a presentation for November. |
@@ -21339,7 +21339,7 @@ <h1>Static Semantics: VarScopedDeclarations</h1> | |||
<emu-clause id="sec-abstract-module-records"> | |||
<h1>Abstract Module Records</h1> | |||
<p>A <dfn>Module Record</dfn> encapsulates structural information about the imports and exports of a single module. This information is used to link the imports and exports of sets of connected modules. A Module Record includes four fields that are only used when evaluating a module.</p> | |||
<p>For specification purposes Module Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Module Record is an abstract class with concrete subclasses. This specification only defines a single Module Record concrete subclass named Source Text Module Record. Other specifications and implementations may define additional Module Record subclasses corresponding to alternative module definition facilities that they defined.</p> | |||
<p>For specification purposes Module Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Module Record is an abstract class with both abstract and concrete subclasses. This specification defines the abstract subclass named Cyclic Module Record and its concrete subclass named Source Text Module Record. Other specifications and implementations may define additional Module Record subclasses corresponding to alternative module definition facilities that they defined.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bterlson We should correct this existing typo in a follow-up (defined => "define" or "suport").
I've noticed a lot of approved-but-not-merged PRs on this repository. This particular one is somewhat blocking to HTML modules work, and we'd love to see it land as soon as possible. |
Most of those aren't approved by all the editors yet (specifically, the editor in chief), thus they're not actually mergeable yet. I'll make sure we address this one in the next editor's meeting. |
…nt (#793) * Rebasing ES spec changes on tc39/ecma262#1311. Misc other fixes/refactorings. * Update ParseHTMLModule to populate missing fields and update HTML MR InitializeEnvironment to create *default* binding for default export of document * Add plumbing for ES spec to get the HTML Module's default export (the document) and set it to the *document* binding during module Evaluation. Plus some other minor corrections. * Update proposal to state that non-module scripts in HTML Module will cause error (rather than being silently coerced to type='module' * Minor wording/typo fixes. Eliminate disclaimer at the top about some parts being handwavy -- we've mostly progressed beyond that, I think. * Add note that parser behavior needs further specification. Change 'fetch a single module script' section to reflect that HTML Modules MIME type discussion is still ongoing.
Another month has passed. What's the process from here? |
@bterlson This PR is labelled "es2019" but I don't know if we talked about whether you wanted to bring this one in for the 2019 branch. Thoughts? |
quick ping to see where this is going. It seems like cyclic module records are going to be a very useful abstraction |
Sorry for the delay, folks. This is good to go! Thanks for sticking with it. |
Thanks for landing this! |
Currently, only Source Text Module Records (STMR) can participate in cycles. From my conversations with those who put that limitation in the spec, this restriction was only added because there wasn't an immediate need for cyclic dependencies with non-STMR modules.
This PR makes it possible for other languages to add module record types that can participate in cycles with Source Text Module Records. To do this, it moves the logic for managing cycles to a new module type, Cyclic Module Record (CMR). STMR are a subclass of the CMR, and other specs such as WebAssembly can also subclass this module record type.
To help with review, I've broken this into smaller commits, but can squash them before merge if that is preferred.
Note: This is an update to #1199. In this version, I removed the concept of "subphases" that was introduced there because they are no longer needed.