Normative: Add text modules #4088
The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/4088 and as multiple pages at https://tc39.es/ecma262/pr/4088/multipage .
<hidden purpose="for-rewritable-pr-comment-action-use" value="tc39_pr_preview_comment"></hidden>
<p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without a `type` attribute. Similarly, hosts are not prohibited from supporting text modules when imported without a `type` attribute.</p>
This is a subtle normative distinction. When we only had type: "json", saying "without type: "json"" was roughly equivalent to saying "without a type attribute". But now that there's multiple values allowed for type, we want to clearly disallow importing JSON with type: "text" or importing text with type: "json". I'm not sure if the committee was ever presented this consequence, and I'd like you to confirm this behaviour prior to Stage 4 advancement.
I think your proposed change is good, and I'll make sure it's presented to the committee; by my recollection this part has not been specifically discussed in committee.
One detail, though: This is within an <emu-note>, which Ecmarkup presents as "Non-normative explanatory text". However, I can't find any part of ECMA-262 that makes that clear, and its reference to Ecmarkup in the Colophon presents it as subservient to ECMA-262, and not as a normative reference.
Given the style of language we have in notes, I don't think they're intended to be normative, but this seems like something that ought to be made explicit, no?
You are correct that notes are non-normative: we cannot introduce new normative requirements in notes. But In this case, I think the clarification in the note does directly follow from the normative steps above. It's just making the consequences of those steps explicit for the reader. So I think it's fine as a note.
<p>The above text requires that hosts support JSON and text modules when imported with the corresponding value for the `type` attribute (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting them when imported without a `type` attribute.</p>
There is also the byte modules proposal that will come at some point, so we can make this note a bit easier to generalize.
It creates a Synthetic Module Record whose default export is _source_, a String whose value should represent textual data.
My point about notes is that I don't think the ECMA-262 spec actually states that notes are non-normative.
Okay, we can fix that: https://github.com/tc39/ecma262/pull/4091
I couldn't apply this from the web UI (is the spec file too long or something?), but did so manually.
is the spec file too long or something?
yep, long-standing GitHub bug
Approved these changes.
): a Synthetic Module Record
Approved these changes.
Approved these changes.
michaelficarra
eemeli
This is the Stage 4 PR for proposal-import-text.