-
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
Annex B reform next steps #1595
Comments
(Not sure if this is up for debate, but here goes anyway.)
The markup is a little hard to discern between all the comments, so I'm going to work through a simple example. Say we have a 2-step normative algorithm:
and we want to inline a single normative-optional step into the middle. It looks like the markup as proposed in that PR would be:
Have I got that right? So the HTML structure goes from
to
I.e., the insertion of a normative-optional step completely disrupts the ecmarkdown text, splitting it into 3 chunks that aren't complete algorithms and aren't even at the same 'level' of the markup tree. I don't know about anyone else, but this would certainly complicate the way that I process the spec. Here's a radically different suggestion:
and then have the rendering process detect "Something-Normative-Optional" and inject whatever HTML markup is necessary to achieve the desired appearance. (I think this would also answer @bterlson's accessibility concerns, since everything you need to know appears in the algorithm text, so we're not requiring the reader to be able to discern the styling.) Of course,
Other benefits of naming each unit of optionality:
|
@jmdyck All this is definitely up for discussion, thanks for your feedback. That idea could be good. I am wondering, how would you represent that an entire property or section is normative optional, as in the RegExp.prototype.compile or document.all cases? |
That I'm not so concerned about, but an attribute on the |
How about |
I thought it already was broken up into units. (I.e., each current B.x.y clause constitutes a unit that a non-browser implementation can choose to implement.) Are you saying that if a non-browser chooses to implement any of Annex B then it must implement all of it? (The spec doesn't seem to be clear on this point.) |
Some people have claimed that; I guess this is a point where there's disagreement between different people who read and edit the specification. I don't work on an environment which doesn't implement Annex B, so I can't really provide input as to what's needed. But I'd prefer to keep things somehow the same as before with respect to the optionality. |
Some people have claimed that;
There was indeed disagreement about whether Annex B was ala carte or
take-it-or-leave-it as a whole. In retrospect, when we had the original
consensus on the current Annex B language, it was a false consensus after
all. We agreed on the words only because we took the words to mean
different things. I know I never agreed to anything other than an ala carte
interpretation of Normative Optional. Realms and SES engineering has
proceeded under an ala carte assumption.
But that historical confusion no longer matters. The consensus from the
discussion on Annex B reform at the recent tc39 meeting is clearly ala
carte. We are proceeding on that basis.
|
For what it's worth, I didn't understand that we were asking the committee for consensus on whether it's ala carte or all-or-nothing. Anyway, I have no particular objection to ala carte, especially if the size of the "menu" is getting drastically smaller (two items?). |
Two now. More soon. That's why getting this resolved was so timely. You get the items exactly right above: Now:
Later. Some in proposals in progress:
|
compile still allows mutating otherwise immutable slots; I’d hope we can keep that normative optional. |
@ljharb That was the question that needed answering. Thanks. |
@ljharb Is your goal here optionality for non-web environments, or is the underlying goal to make it formally deprecated? Any guarantee of immutability-by-default for the RegExp seems somehow weak when many environments will have it be mutable. |
Should we shift up the other annexes or give Annex B an intentionally left blank tombstone? 🙃 |
@syg maybe just reuse Annex B to describe the normative optional features? |
Summarizing the inlined items sounds good to me! |
@littledan the current status is that it's optional for non-web environments; at least I want to maintain that. It would be super great to remove it from the web entirely, of course, but that seems a separate effort from this issue. |
@erights Are the slides from your talk at this past meeting in Berlin publicly available? |
attached: |
Possibly off-topic: There is Stage 0 proposal named "Annex B — HTML Attribute Event Handlers" in Stage 0 proposals list. I don't know what's the status of that proposal and what it is about exactly (it doesn't have its own repo or gist and I can't find any related discussions in notes repo), but maybe it could be important to mention it here. Sorry if it's not. |
cc @allenwb ^ should that item still be on the active proposals list? |
The motivation was the need to specify, from an ES perspective, the semantics of source code used as the value of an event handler HTML attribute. EG,
This item was added to the strawman proposal list probably in early 2014. I believe this was before the HTML spec. had such a detailed specification of the processing of such attributes. The current HTML specification probably eliminates the need to handle this as an Annex B item, but I think it illustrates that there are still specification layering issues regarding a clear semantics that supports host environments that want to provide a mechanism that takes JS source code and uses it as the body of a synthesized function definition. HTML event handler attributes do this, so does CJS when defining its modules. I believe other host also do similar things. The HTML spec. does a fair amount of low level ES spec. hackery to define its behavior, some of which would not be directly applicable to other hosts. It seems to me that it would be desirable to have a more generalized Host* ES interface that allows various hosts to define such functions without doing fragile spec. hacking. So, maybe not Annex B issue anymore but probably something that should be ticketed as a spec. layering issue. |
Sounds like we should remove the proposal, but someone who's involved with HTML should file that layering issue to pursue that goal. Thanks for the history! |
Is there more that needs to be decided here, or can people start submitting PRs? I'd gladly submit one that merges the Annex B grammar modifications into the main body. |
Hi @jmdyck , thanks for the offer! Please proceed. I'm sure that we'll still run into controversy, but this is a good way forward. I am hopeful. |
(Part of Annex B reform, see PR tc39#1595.)
Draft PR #1651 available for early review. |
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. We want to continue to disallow such syntax in strict mode, but the mechanism to do so must change. Formerly, the spec would say that in such contexts, it's forbidden to extend the syntax in this way. But since (with this PR), this is no longer an extension, we instead use early error rules to say that in such contexts, occurrences of the 'new' parts of the syntax are Syntax Errors. For change 1, making it a Syntax Error is fairly straightforward. But for change 2, we can't simply say that LegacyOctalEscapeSequence is a Syntax Error in strict mode, because strict mode still has to allow the restricted syntax. Instead, we say that if we're in strict mode code, an instance of LegacyOctalEscapeSequence is a Syntax Error *unless* it's an instance of the restricted syntax. To express the latter condition, we use the cover grammar machinery. (It could be done in other ways, but I think this is clearest.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. We want to continue to disallow such syntax in strict mode, but the mechanism to do so must change. Formerly, the spec would say that in such contexts, it's forbidden to extend the syntax in this way. But since (with this PR), this is no longer an extension, we instead use early error rules to say that in such contexts, occurrences of the 'new' parts of the syntax are Syntax Errors. For change 1, making it a Syntax Error is fairly straightforward. But for change 2, we can't simply say that LegacyOctalEscapeSequence is a Syntax Error in strict mode, because strict mode still has to allow the restricted syntax. Instead, we say that if we're in strict mode code, an instance of LegacyOctalEscapeSequence is a Syntax Error *unless* it's an instance of the restricted syntax. To express the latter condition, we use the cover grammar machinery. (It could be done in other ways, but I think this is clearest.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. We want to continue to disallow such syntax in strict mode, but the mechanism to do so must change. Formerly, the spec would say that in such contexts, it's forbidden to extend the syntax in this way. But since (with this PR), this is no longer an extension, we instead use early error rules to say that in such contexts, occurrences of the 'new' parts of the syntax are Syntax Errors. For change 1, making it a Syntax Error is fairly straightforward. But for change 2, we can't simply say that LegacyOctalEscapeSequence is a Syntax Error in strict mode, because strict mode still has to allow the restricted syntax. Instead, we say that if we're in strict mode code, an instance of LegacyOctalEscapeSequence is a Syntax Error *unless* it's an instance of the restricted syntax. To express the latter condition, we use the cover grammar machinery. (It could be done in other ways, but I think this is clearest.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. Change 1 is straightforward, but change 2 is tricky. In the EscapeSequence production, we can't simply replace the `0` alternative with LegacyOctalEscapeSequence (as B.1.2 does), because the `0` alternative must be treated differently from everything else that LegacyOctalEscapeSequence derives. (The `0` alternative is allowed in contexts where everything else that LegacyOctalEscapeSequence derives is forbidden.) So instead, we redefine LegacyOctalEscapeSequence to exclude the `0` alternative. Specifically, the 'overlap' comes from: LegacyOctalEscapeSequence :: OctalDigit [lookahead ∉ OctalDigit] so we replace that with: LegacyOctalEscapeSequence :: `0` [lookahead ∈ {`8`, `9`}] NonZeroOctalDigit [lookahead ∉ OctalDigit] (See Issue tc39#1975 for more details.) Resolves tc39#1975.
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Merge its Syntax, Static Semantics, and Runtime Semantics into the main body.) (Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.)
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. Change 1 is straightforward, but change 2 is tricky. In the EscapeSequence production, we can't simply replace the `0` alternative with LegacyOctalEscapeSequence (as B.1.2 does), because the `0` alternative must be treated differently from everything else that LegacyOctalEscapeSequence derives. (The `0` alternative is allowed in contexts where everything else that LegacyOctalEscapeSequence derives is forbidden.) So instead, we redefine LegacyOctalEscapeSequence to exclude the `0` alternative. Specifically, the 'overlap' comes from: LegacyOctalEscapeSequence :: OctalDigit [lookahead ∉ OctalDigit] so we replace that with: LegacyOctalEscapeSequence :: `0` [lookahead ∈ {`8`, `9`}] NonZeroOctalDigit [lookahead ∉ OctalDigit] (See Issue tc39#1975 for more details.) Resolves tc39#1975.
In the June 2019 TC39 meeting, @erights raised the topic of Annex B reform. We reached consensus on two high-level points, but there remain many details to work out, which I'd like to elaborate on in this thread:
In some more detail:
Making some Annex B things normative
The lens proposed by @erights was that we make normative everything which is "perfectly safe from a non-locality, causality perspective".
Of particular concern are grammar issues, where having multiple divergent grammars (both for HTML comments and RegExp grammars) leads to security and implementer confusion issues. Mark also proposed that other parts of the specification which are simply ugly, but not harmful from an SES/ocap perspective, be considered normative.
We didn't discuss what this means in detail, in particular, which things will go into the main spec. Based on the notes and my reading of the specification, I'd say that includes
__proto__
accessor and pre-ES5 accessor APIsubstr
are especially unfortunate, as we may want to discourage use of some of these. If we want to mark it specially, I'd suggest inline "normative deprecated" marking, rather than making it optional.Is any of the above in error?
Making Annex B inline
The general strategy for inline Annex B would be to follow what we've done with Intl for legacy constructor semantics. These are also "normative optional", but listed interspersed with other specification text. The idea is that this phrasing makes the text more readable, while preserving its optionality outside of web browsers. This should help avoid situations where people have read part of the specification, not realizing that another part modified it, resulting in confusion and non-Annex-B-compatible implementations when the intention was to be web-compatible.
See an example in the WeakRefs proposal of adding some inline Annex B text (PR), and similar text in Intl (PR).
@bterlson raised concerns about the accessibility of the Intl specification's normative optional text. I'm not an expert in this area; if someone has an idea for better CSS, or HTML generated from ecmarkup, it'd be great to have your help.
Items which @erights's presentation proposed to leave as normative optional, which I'd suggest should be inline normative optional:
Future proposals which could be inline normative optional, per @erights's suggestions:
Next steps
The text was updated successfully, but these errors were encountered: