-
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
Editorial: document forbidden extension #2560
base: main
Are you sure you want to change the base?
Conversation
This restriction has previously been documented in the section titled "ECMAScript Standard Built-in Objects". Include it in the section designed to summarize all such restrictions.
I think you have to allow editing in this PR: https://github.com/tc39/ecma262/runs/4042060169?check_suite_focus=true |
No, the issue is that PRs from forks that aren’t your own - in this case, bocoup - don’t actually allow force pushing by collaborators. @jugglinmike can you add me to bocoup’s fork? That way we’ll be prepared to land this when it’s time. (this can be avoided in the future by making all PRs from your personal fork) |
Just out of curiosity, is this supposed to specifically be a TypeError and not any Error? |
I'm not sure this belongs in 17.1. In the context of clause 17, an 'extension' is (roughly) where an implementation takes a Script/Module that would (in a 'minimal' implementation) throw an error, and replaces that outcome with some non-error behavior. And then 17.1 lists the few cases of error-to-non-error that are forbidden. But what you're describing (as forbidden) is the opposite, turning a particular non-error into an error. |
Thanks, @jmdyck. I can see now that still other restrictions are not present in this section (e.g. "an ECMAScript implementation must not provide any means to observe a key of a WeakMap that does not require the observer to present the observed key."). Your rough "error behavior" reading might demonstrate that this is intentional. Still, I don't think it's very far-fetched to interpret the term "extension" to mean "any observable behavior not specified by this document." If the term is actually more specific than that, I'd like to explain in the section's description. Do you know why it's useful to only summarize those specific kinds of restrictions? That might help me write a more precise explanation. |
I agree that 17 could be clearer.
That phrasing suggests to me that you might have the wrong idea about 17.1. E.g., you might be thinking of it like Annex C, which just collects + restates all the strict mode restrictions that are expressed in the body of the spec. (So, if Annex C suddenly disappeared, you could more-or-less reconstruct it.) But that isn't true of 17.1. As I understand it, nothing outside of 17.1 tells you what should be in 17.1. As @allenwb says:
So 17.1 doesn't summarize specific kinds of restrictions. (Or maybe I've misunderstood your question.) The spec's conformance model can be a bit hard to grasp. The vast bulk of the spec (all the grammars, pseudocode, and prose) define an abstract model of an ECMAScript processor, so it's tempting to conclude that the behavior exhibited by that model (ignoring some non-determinism) is the behavior required of compliant implementations. But really, that's just a baseline, a first approximation. You then have to apply clauses 2 and 17. Roughly speaking, I think the second-level approximation is:
(But I'm pretty sure there are exceptions to both points. E.g., the model has no memory constraints, so will never throw an out-of-memory error, but I think an implementation can do so and still be compliant. And maybe there are categories of baseline error behavior that compliant implementations do have to reproduce; I'm not sure. And realistically, the freedom of point 2 would be limited to what the implementation has said it will do.) Anyway, I bring all that up to say:
|
Ah, now I understand--thank you! (That discussion thread is fascinating, by the way.) Do you think section 2 or 17.1 would benefit from some acknowledgement that there are additional normative restrictions throughout the standard? On the one hand, from a conformance standpoint, the distinction between "restriction" and "requirement" might not be so interesting. On the other, the conformance model is generally so permissive that I wonder if it's worth simply adding that, "17.1 is not exhaustive." |
I wouldn't phrase it like that, but I think 2 or 17.1 could be clearer about the compliance model and/or what is/isn't compliant behavior.
Not sure what you mean. As I understand it, 17.1 is exhaustive: it lists all the forbidden extensions. |
Right, I got tripped up by the definition of "extension" again. Maybe that's what's missing from the compliance model. |
This restriction has previously been documented in the section titled "ECMAScript Standard Built-in Objects". Include it in the section designed to summarize all such restrictions.
I tried to match the original language. That said, the original language might be a little confusing out of context. Maybe this would be better: