A record of the branch proposal-defer-import-eval · site/proposal-defer-import-eval.json
Applying a proposal
What it takes to apply a TC39 proposal to this specification, shown on tc39/proposal-defer-import-eval: the text merged, what was written by hand, what was regenerated, what the merge found, and the results.
What was done
The proposal tc39/proposal-defer-import-eval, at its commit f19b6c5, was applied to ECMA-262 at b1eaed82f in a branch of this repository, proposal-defer-import-eval (acbd03d, from 3a2102a): the proposal's text merged into the specification's, the Lean specification regenerated from the result, the engine built and its claims checked, and the proposal's test262 tests run.
- 1,042lines added by hand (−211 removed) across 24 files: the pin, 10 merge answers, SpecTec definitions & HTML metadata (including 14 step readings), and tests
- 0files of hand-written Lean changed
- 251of the proposal's 252 test262 tests (
import-defer) pass; 1 not run, none fails
How a proposal is applied
- Pin it. The proposal's repository is a submodule,
external/proposal-defer-import-eval, atf19b6c5, and one line ofspec/proposals.txtnames it with its answers file. - Merge it.
scripts/apply_proposal.pyreads the proposal'sspec.emuas a diff against ECMA-262: it matches each clause by itsidand each block of the clause by its old text (the block with its<ins>dropped and its<del>kept), which must be the base's; it inserts the proposal's new clauses and removes the ones it deletes. Where the old text is not the base's, or an inserted block's place is not shown, it refuses and asks: the answers file (spec/proposals/defer-import-eval/resolutions.txt) answers each question, one line each. - The text.
scripts/spec_text.pymakes the text every generator, check and page reads: ECMA-262 with the proposals ofspec/proposals.txtapplied, remade whenever an input changes. - SpecTec.
lean/SpecTec/Html(spectec-html) translates new or changed algorithms, grammar rules, tables and early errors intospec/spectec/and checks the round-trip back to the mergedspec.html. - Regenerate.
python3 scripts/generate.pyrunsspectec emitoverspec/spectec/to writelean/Ecma/Genandlean/Ecma/Grammar/Gen(python3 scripts/spec_text.py --reportsays what the merge did). - Build and check.
lake build, the axiom check of the claims,python3 scripts/quick_check.py, and test262 with the proposal's feature no longer in[skip-features].
What was written by hand
| File | Added | Removed |
|---|---|---|
.gitmodules | +3 | −0 |
external/proposal-defer-import-eval (new) | +1 | −0 |
spec/proposals.txt | +2 | −6 |
spec/proposals/defer-import-eval/gaps-resolutions.txt (new) | +7 | −0 |
spec/proposals/defer-import-eval/gaps.emu (new) | +70 | −0 |
spec/proposals/defer-import-eval/resolutions.txt (new) | +46 | −0 |
spec/html/item-meta.txt | +16 | −1 |
spec/html/step-patches.txt | +244 | −70 |
spec/spectec/00-decls.spectec | +20 | −1 |
spec/spectec/03-grammar-syntactic.spectec | +8 | −2 |
spec/spectec/07-grammar-index.spectec | +3 | −1 |
spec/spectec/09-tables.spectec | +288 | −5 |
spec/spectec/10-realm.spectec | +0 | −1 |
spec/spectec/clauses/Helpers.spectec | +9 | −0 |
spec/spectec/clauses/S10.spectec | +42 | −20 |
spec/spectec/clauses/S13.spectec | +69 | −22 |
spec/spectec/clauses/S16.spectec | +163 | −42 |
spec/spectec/clauses/S27.spectec | +41 | −18 |
tests/run/frontend_not_ecmascript.js | +3 | −2 |
tests/run/import_defer_basic.js | +3 | −6 |
tests/run/import_defer_dynamic.js | +2 | −5 |
tests/run/import_defer_tla.js | +3 | −6 |
tests/test262/full.conf | +0 | −1 |
tests/test262/sample.conf | +0 | −1 |
tests/test262/suite.conf | +0 | −1 |
Hand-written Lean: 0 files changed under lean/ outside its generated directories.
The answers to the merge (10)
| Answer | The question the merge asked | Why this answer |
|---|---|---|
ignore sec-LoadRequestedModules 1 | the clause's header (<dl class="header">) has no markup but is not the base's | the proposal abbreviates it: it drops the <dt>description</dt> (and, in InnerModuleLoading and InnerModuleLinking, every entry). It changes nothing there, so the base's header stays |
ignore sec-InnerModuleLoading 1 | the clause's header (<dl class="header">) has no markup but is not the base's | the proposal abbreviates it: it drops the <dt>description</dt> (and, in InnerModuleLoading and InnerModuleLinking, every entry). It changes nothing there, so the base's header stays |
ignore sec-moduledeclarationlinking 1 | the clause's header (<dl class="header">) has no markup but is not the base's | the proposal abbreviates it: it drops the <dt>description</dt> (and, in InnerModuleLoading and InnerModuleLinking, every entry). It changes nothing there, so the base's header stays |
ignore sec-InnerModuleLinking 1 | the clause's header (<dl class="header">) has no markup but is not the base's | the proposal abbreviates it: it drops the <dt>description</dt> (and, in InnerModuleLoading and InnerModuleLinking, every entry). It changes nothing there, so the base's header stays |
place sec-InnerModuleLoading 2 after 2 | the proposal inserts a note (<emu-note> all <ins>) but omits the header and the algorithm around it: before or after the algorithm? | after it (base block 2 is the algorithm): a note on an algorithm follows it, as everywhere in the text, and the note speaks of the algorithm's steps |
place sec-InnerModuleLinking 2 after 2 | the proposal inserts a note (<emu-note> all <ins>) but omits the header and the algorithm around it: before or after the algorithm? | after it (base block 2 is the algorithm): a note on an algorithm follows it, as everywhere in the text, and the note speaks of the algorithm's steps |
rebase sec-source-text-module-record-initialize-environment 2 | InitializeEnvironment's steps: the proposal's old text lacks two of the base's lines, Assert: _exportEntry_.[[ExportName]] is not *null*. (1.a) and Assert: _importEntry_.[[ImportName]] is a String. (7.c.i) | the base is newer than the proposal's copy; the proposal's changes (GetModuleNamespace's new phase argument, twice, and the ~deferred-namespace~ branch of 7.c.iii) touch other lines, so the three-way merge applies them to the base with no conflict and both Asserts stay |
rebase sec-resolveexport 2 | ResolveExport's steps: the proposal's old text has an Else, after Return ResolvedBinding Record { … ~namespace~ }. that the base no longer has | the same: the base dropped it, the proposal's change (the ~deferred-namespace~ branch) is elsewhere in the algorithm, and the merge applies it to the base's lines |
rebase-take sec-abstract-module-records 4 | Module Record Fields: the table differs as a whole (the base gained a <thead>), and row by row too, at [[Namespace]]'s Meaning | the proposal rewrote that cell without <ins>/<del>: the link to #sec-module-namespace-objects (a clause it deletes) becomes #sec-module-namespace-exotic-objects, and "whose [[Deferred]] slot is false," is added. That is the proposal's change, so its line wins where it differs from the base; the base's <thead> stays. |
rename ModuleRequestsEqual ModuleRequestsKeyEqual | a warning: ModuleRequestsEqual, whose clause the proposal removes (del-sec-ModuleRequestsEqual), is still used in 6 clauses the proposal does not show | the proposal's new clause ModuleRequestsKeyEqual takes over the old one's id (oldids="sec-ModuleRequestsEqual"), with the same steps, and the proposal renames the two uses it shows; the other seven uses (Realm Record and Script Record [[LoadedModules]], Cyclic Module Record [[LoadedModules]], InnerModuleLoading 2.d.ii, GetImportedModule 1, HostLoadImportedModule's requirements) are renamed with it. |
The readings (14)
Each reading says what a sentence of the proposal means where the merged prose is informal or incomplete: 10 new, 3 re-anchored, 1 replaced. The proposal's sentence is quoted from the merged text (matched via spec/html/step-patches.txt); the reasons are the branch's report's.
| Clause, step | The proposal's sentence, as the merged text has it | The reading |
|---|---|---|
| 10.4.6.6 [[DefineOwnProperty]], step 1 new | If IsSymbolLikeNamespaceKey(propertyKey, obj), return ! OrdinaryDefineOwnProperty(obj, propertyKey, propertyDesc). |
|
| Why SpecTec records an explicit step reading: a Boolean call used bare as a condition. ECMA-262 never writes one, so the notation has no such form | ||
| 10.4.6.7 [[HasProperty]], step 1 new | If IsSymbolLikeNamespaceKey(propertyKey, obj), return ! OrdinaryHasProperty(obj, propertyKey). |
|
| Why SpecTec records an explicit step reading: a Boolean call used bare as a condition. ECMA-262 never writes one, so the notation has no such form | ||
| 10.4.6.8 [[Get]], step 1 new | If IsSymbolLikeNamespaceKey(propertyKey, obj), then |
|
| Why SpecTec records an explicit step reading: a Boolean call used bare as a condition. ECMA-262 never writes one, so the notation has no such form | ||
| 10.4.6.10 [[Delete]], step 1 new | If IsSymbolLikeNamespaceKey(propertyKey, obj), then |
|
| Why SpecTec records an explicit step reading: a Boolean call used bare as a condition. ECMA-262 never writes one, so the notation has no such form | ||
| 16.2.1.5.1.2 ReadyForSyncExecution, step 5 new | If IsModuleSCCEvaluated(module), return true. |
|
| Why SpecTec records an explicit step reading: a Boolean call used bare as a condition. ECMA-262 never writes one, so the notation has no such form | ||
| 16.2.1.13 GetModuleNamespace, step 2 new | If phase is defer, let namespace be module.[[DeferredNamespace]]. Else, let namespace be module.[[Namespace]]. |
|
| Why SpecTec records an explicit step reading: an inline conditional written as two sentences. The text writes "…; else let …" everywhere else | ||
| 13.3.10.5 ContinueDynamicImport, step 6.d.iv new | For each Module Record dep of evaluationList, append dep.Evaluate() to asyncDepsEvaluationPromises. |
|
| Why SpecTec records an explicit step reading: a For each with an inline body, which the text writes nowhere else | ||
| 16.2.1.6.1.3 Evaluate, step 1 new | Assert: None of module or any of its recursive dependencies have [[Status]] set to evaluating, linking, unlinked, or new. |
|
| Why SpecTec records an explicit step reading: "recursive dependencies" is defined nowhere. There is no model operation for it, so this is the one new loop | ||
| 16.2.1.9 GetImportedModule, step 1 re-anchored | Let records be a List consisting of each LoadedModuleRequest Record r of referrer.[[LoadedModules]] such that ModuleRequestsKeyEqual(r, request) is true. |
|
| Why SpecTec records an explicit step reading: the rename changed the step's hash, so the reading lost its anchor | ||
| 13.3.10.4 EvaluateImportCall, step 9.f re-anchored | Sort attrs according to the lexicographic order of their [[Key]] field, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated. |
|
| Why SpecTec records an explicit step reading: the step was renumbered | ||
| 16.2.1.6.1.3.1 InnerModuleEvaluation, step 18.b.iv re-anchored | Assert: requiredModule.[[AsyncEvaluationOrder]] is either an integer or unset. |
|
| Why SpecTec records an explicit step reading: the step was renumbered | ||
| 10.4.6.12 ModuleNamespaceCreate, step 9 replaced | Create an own data property of namespace named %Symbol.toStringTag% whose [[Value]] is toStringTag and whose [[Writable]], [[Enumerable]], and [[Configurable]] attributes are false. |
|
| Why SpecTec records an explicit step reading: the old reading created the properties of §28.3, which the proposal deletes; the new sentence has no phrase ("CreateOwnProperty, unclassified") | ||
| 8.2.1 BoundNames new | No row for |
|
| Why SpecTec records an explicit step reading: the proposal's text does not give it; the reading gives what test262's tests of the proposal require | ||
| 16.2.1.8.1 CreateDefaultExportSyntheticModule, step 3 new | Return the Synthetic Module Record { [[Realm]]: realm, [[Environment]]: empty, [[Namespace]]: empty, [[HostDefined]]: undefined, [[ExportNames]]: « "default" », [[EvaluationSteps]]: setDefaultExport }. |
|
| Why SpecTec records an explicit step reading: the proposal's text does not give it; the reading gives what test262's tests of the proposal require | ||
What regenerating changed
Generated Lean modules (lean/Ecma/Gen and lean/Ecma/Grammar/Gen) are gitignored and emitted directly from spec/spectec/ by scripts/generate.py.
Every identifier in SpecTec is symbolic (How it works); lean/SpecTec derives sorted numeric indices and Ecma.Known constants automatically when emitting Lean, so diffs stay confined to the changed SpecTec definitions and downstream proofs continue to name the same declarations.
What the merge found in the proposal's text
Run with no answers, the merge refuses 9 times and warns 1 time. The refusals, by what the answer found them to be:
| Refusal | Count |
|---|---|
| a context block that is not the base's (an abbreviated header) | 4 |
| an inserted block whose place is not shown | 2 |
| old text that is not the base's: the base changed after the proposal was written | 2 |
| old text that is not the base's: the proposal changed it without marking it | 1 |
The warning: ModuleRequestsEqual (sec-ModuleRequestsEqual, removed (sec-ModuleRequestsEqual)) is still used in 6 clause(s): sec-GetImportedModule, sec-HostLoadImportedModule, sec-InnerModuleLoading, sec-code-realms, sec-cyclic-module-records, sec-script-records; answer with `rename ModuleRequestsEqual NEW` if the proposal renames it.
With the answers, it changes 26 clauses, inserts 11, removes 2 and copies 3 figures; every one of the proposal's 129 <ins> texts is in the result, none of its 57 <del> texts is left, and the clause tree is the base's less the removed clauses plus the inserted ones.
For the merge to ask nothing, a proposal's text would reproduce whole blocks (no abbreviated headers; an inserted note shown with the algorithm before it), be written against the current ECMA-262, mark every change with <ins> and <del>, and rename a removed operation at every call or say that the rest are renamed with it.
The results
test262. The 252 tests of the feature import-defer at test262 2e58f87d8: 251 pass, 1 skip (not run: language/import/import-defer/evaluation-triggers/ignore-private-name-access.js, feature nonextensible-applies-to-private).
| Directory | Pass | Not passing | Skipped |
|---|---|---|---|
language/expressions/assignmenttargettype | 2 | ||
language/expressions/dynamic-import | 147 | ||
language/import/import-defer | 102 | 1 |
The claims. On the branch, Engine.implements and Engine.run_sound rest on propext, Classical.choice, Quot.sound alone (no native_decide pins); the same list as without the proposal.
The programs. Each of the proposal's three example programs, under the proposal's build and under the specification's (both checked when this site was built):
| Program | With the proposal | The specification |
|---|---|---|
tests/run/import_defer_basic.js | normal: undefined[object Deferred Module]main starts; heavy evaluates; read 42; read again 42 | throw: SyntaxError |
tests/run/import_defer_dynamic.js | normal: undefinedpromise settled; then in ns: false; dep evaluates; x is 1 | throw: SyntaxError |
tests/run/import_defer_tla.js | normal: undefinedbefore access: b, e, d, aafter access: b, e, d, a, f, c | throw: SyntaxError |
Try it
The debugger has the proposal's build: under it each program runs and pauses in the proposal's algorithms.
import defer: a namespace evaluated at its first read
import.defer(): a promise for an unevaluated namespace
import defer and top-level await