Brendan Eich wrote:
Kevin Smith wrote:
I wonder if you'd need to go back to the lexer in some cases:
function(a = let) {
"use strict";
}
After seeing the "use strict", I'd have to go back and re-scan the
"let" to find out that it was actually a keyword in this context (and
hence a syntax error).
The current spec definitely makes 'let' reserved only in strict mode,
but we have no let expression forms, so this looks like another case
of parsing the kind of example you show above with 'let' in the
parameter default value lexed as an Identifier but then rejected
during the static semantics phase as an always-an-error-in-expressions
reserved word. Good catch. Still tolerable, I think.
You may be thinking, "Argh, strict mode is deep, so this ought to parse,
does it require relexing?"
function f(a = function(){let x = 42; return x}()) {
"use strict";
return a;
}
But IIRC (and from reading
http://people.mozilla.org/~jorendorff/es6-draft.html, looking for
LetOrConst uses), ES6 supports let in all contexts, reserved word or not.
Did we really do any good trying to reserve yield *or* let in ES5? I
don't see it, now.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss