Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAnnex B.3.5 CatchParameter legacy remedy could be narrower #150
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Yes, this sounds like a good narrowing of the B.3.5 form of the rule. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
anba
Oct 30, 2015
Contributor
The current specification also allows this:
try {
...
} catch (e) {
var [e] = ...
}Should that form also be made invalid?
[...] unless BoundNames contains a single element and [...]
"unless CatchParameter is CatchParameter : BindingIdentifier and " to handle catch ({stack}) {...} correctly.
|
The current specification also allows this: try {
...
} catch (e) {
var [e] = ...
}Should that form also be made invalid?
"unless CatchParameter is CatchParameter : BindingIdentifier and " to handle |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Yes, that final change should do it. |
pushed a commit
to paul99/v8mips
that referenced
this issue
Nov 4, 2015
pushed a commit
to paul99/v8mips
that referenced
this issue
Nov 4, 2015
bterlson
closed this
in
02e46ab
Nov 10, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ajklein commentedOct 29, 2015
The early errors for Try/Catch names includes the following passage:
"It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the VarDeclaredNames of Block."
However, this is modified in B.3.5 to allow code of the form:
to run without complaint, presumably for legacy compat reasons. The spec text says:
"It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the VarDeclaredNames of Block, unless that element is only bound by a VariableStatement or the VariableDeclarationList of a for statement, or the ForBinding of a for-in statement."
But this means that the following is also allowed:
What's the motivation for allowing the destructured form, given that there will be no legacy concerns in that case? One could imagine the spec could instead read:
"It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the VarDeclaredNames of Block, unless BoundNames contains a single element and that element is only bound by a VariableStatement or the VariableDeclarationList of a for statement, or the ForBinding of a for-in statement."