-
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
Normative: Add Import Attributes #3057
base: main
Are you sure you want to change the base?
Conversation
@tc39/ecma262-editors Currently the only remaining condition for this proposal to be actually Stage 3 is the editorial review. It'd be great if you have time to do it :) |
43b46ec
to
891ceab
Compare
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.
LGTM other than comments.
I pushed two more normative commits, that are oversights from the
|
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 are various SDOs defined on the current forms of ImportCall
, ImportDeclaration
, and/or ExportDeclaration
that are not defined on the new forms:
- BoundNames
- Evaluation
- ExportEntries
- ExportedBindings
- ExportedNames
- HasCallInTailPosition
- ImportEntries
- LexicallyScopedDeclarations
- ModuleRequests
spec.html
Outdated
|
||
<p>The following augments the |ImportDeclaration| and |ExportDeclaration| productions in <emu-xref href="#sec-imports"></emu-xref> and <emu-xref href="#sec-exports"></emu-xref>:</p> | ||
<!-- emu-grammar[type=definition] have different margin than other emu-grammar, but we want this to be aligned with the one below. --> | ||
<emu-grammar style="display:block; margin-left: 5ex"> |
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.
I still think this should be marked type="definition"
(and ecmarkup should be modified to treat it appropriately).
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.
(Actually, at this point, even if ecmarkup isn't modified, the effect should be pretty minor, since AttributesKeyword
is the only affected nonterminal now.)
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.
I will try to modify ecmarkup. It already supports duplicated definitions, but only in annexes.
I pushed two new commits:
|
af6b0a0
to
e35e486
Compare
Why not just tweak @bakkot's suggestion into:
That would eliminate the |
|
I pushed @jmdyck's suggestion, to show how much it would simplify the spec. |
A And there's nothing in the definition of So I don't think we should have any qualms about using it in this way. |
I think the
|
spec.html
Outdated
1. Assert: Exactly one element of _referrer_.[[LoadedModules]] is a Record whose [[Specifier]] is _specifier_, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation. | ||
1. Let _record_ be the Record in _referrer_.[[LoadedModules]] whose [[Specifier]] is _specifier_. | ||
1. Assert: Exactly one element of _referrer_.[[LoadedModules]] is a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _request_) is *true*, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation. | ||
1. Let _record_ be the LoadedModuleRequest Record in _referrer_.[[LoadedModules]] such that ModuleRequestsEqual(_record_, _request_) is *true*. |
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.
The form of this Let
step is unusual. Normally, in Let _foo_ be <something>
, the alias _foo_
doesn't appear in <something>
.
For the 2 steps, maybe something more like:
1. Let _x_ be a List consisting of
each LoadedModuleRequest Record _record_
of _referrer_.[[LoadedModules]] such that etc.
3. Assert: _x_ has exactly one element.
4. Let _record_ be the sole element of _x_.
(That also eliminates the duplication between the two steps.)
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.
Uh ecmarkup's linting doesn't like this
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.
Yeah, given
... a List consisting of each LoadedModuleRequest Record _r_
of _referrer_.[[LoadedModules]] such that <condition>
ecmarkup is saying that it can't find a preceding declaration for _r_
. That is, it's treating this occurrence of _r_
as a 'use', whereas it's syntactically a declaration.
@bakkot: could ecmarkup be modified to treat this as a declaration?
spec.html
Outdated
|
||
<p>The following augments the |ImportDeclaration| and |ExportDeclaration| productions in <emu-xref href="#sec-imports"></emu-xref> and <emu-xref href="#sec-exports"></emu-xref>:</p> | ||
<!-- emu-grammar[type=definition] have different margin than other emu-grammar, but we want this to be aligned with the one below. --> | ||
<emu-grammar style="display:block; margin-left: 5ex"> |
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.
(Actually, at this point, even if ecmarkup isn't modified, the effect should be pretty minor, since AttributesKeyword
is the only affected nonterminal now.)
PR updated to remove support for float and bigint literal keys, as per consensus in the TC39 2023-09 meeting. |
a8c7397
to
940fcb2
Compare
* Add Import Attributes proposal * `npm run format` * Updates from review * Changes from review * Do not re-define ImportDeclaration * Add `assert` deprecated syntax to `export ... from` * Remove `[no LineTerminator here]` before `with` * Use optional symbols to reduce grammar * Update ImportEntries and ExportEntry to use ModuleRequest Records * Review from Michael * Replace AttributeKey with LiteralPropertyName * Separate ModuleRequest and LoadedModuleRequest fields * Validate attrs when lodaing deps and not when parsing * Merge `AssertClause` into `WithClause`, and fix missing SDOs * Fix type annotation * Simplify AttributesKeyword * Reviews * Review * Remove support for float and bigint literal keys * Update wording
940fcb2
to
c14c38a
Compare
This proposal (https://tc39.es/proposal-import-attributes/, https://github.com/tc39/proposal-import-attributes) reached stage 3 during the March 2023 meeting, conditional on stage 3 reviews. I'm opening this PR before "real" stage 3 to help editors reviewing the full spec changes.
The proposal has already been integrated in HTML: https://html.spec.whatwg.org/#hostloadimportedmodule
PREVIEW: https://ci.tc39.es/preview/tc39/ecma262/pull/3057
DIFF: https://arai-a.github.io/ecma262-compare/?pr=3057 (note: the diff doesn't mark deprecated sections)