Skip to content
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

Are legacy escapes in strict mode code a valid extension? #2432

Open
jmdyck opened this issue Jun 10, 2021 · 2 comments
Open

Are legacy escapes in strict mode code a valid extension? #2432

jmdyck opened this issue Jun 10, 2021 · 2 comments
Labels

Comments

@jmdyck
Copy link
Collaborator

jmdyck commented Jun 10, 2021

Working on PR #1867, I've been looking at 17.1 Forbidden Extensions, and I noticed that, it does have an entry saying:

When processing strict mode code, the syntax of NumericLiteral must not be extended to include LegacyOctalIntegerLiteral and the syntax of DecimalIntegerLiteral must not be extended to include NonOctalDecimalIntegerLiteral as described in B.1.1.

but it doesn't have an entry saying:

When processing strict mode code, the syntax of EscapeSequence must not be extended to include LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence as defined in B.1.2.

This seems to indicate that it's okay for an implementation to provide the latter as an extension. I'm thinking this is probably an oversight (going back to ES6). Is it?


Background: B.1.1 and B.1.2 are otherwise fairly similar in terms of what's allowed and what's disallowed. Specifically:

12.8.3 Numeric Literals says:

A conforming implementation, when processing strict mode code, must not extend, as described in B.1.1, the syntax of NumericLiteral to include LegacyOctalIntegerLiteral, nor extend the syntax of DecimalIntegerLiteral to include NonOctalDecimalIntegerLiteral.

and 12.8.4 String Literals says:

A conforming implementation, when processing strict mode code, must not extend the syntax of EscapeSequence to include LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence as described in B.1.2.

(These sentences are both repeated in Annex C.)

Similarly, B.1.1 Numeric Literals says:

The syntax and semantics of 12.8.3 is extended as follows except that this extension is not allowed for strict mode code

and B.1.2 String Literals says:

The syntax and semantics of 12.8.4 is extended as follows except that this extension is not allowed for strict mode code

At which point, you might think "Isn't it pretty obvious then? They're both not allowed in strict mode code." However, I think this just means that these things are not allowed in what you might call a "baseline" or "minimal" implementation. But 17 Error Handling and Language Extensions gives implementations a lot of leeway to add extensions, as long as they aren't explicitly forbidden in 17.1. So it's odd that 17.1 would forbid (as an extension) B.1.1 in strict mode code, but not B.1.2 in strict mode code.

@jmdyck
Copy link
Collaborator Author

jmdyck commented Jun 10, 2021

On the other hand, maybe the anomaly in 17.1 isn't the absence of B.1.2, but the presence of B.1.1.

E.g., if you look at C The Strict Mode of ECMAScript and compare it to 17.1 Forbidden Extensions, the only thing that's clearly in both lists is B.1.1. (They also both have one about function properties named "caller" or "arguments", but they seem to be saying different things.) That is, almost all of the things that strict mode disallows are not explicitly forbidden as extensions. So then it's odd that one of them is.

@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label Jun 23, 2021
@michaelficarra
Copy link
Member

The editors feel this is something worth addressing and something that would require confirmation of intent from the committee, however it is not a very high priority for any of us at this moment, and none of us plan to bring this topic to committee in the near future.

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants