Can `let`, `static` and `yield` still be used as Identifier?
This is a bug in Traceur.
An HTML attachment was scrubbed... URL: esdiscuss/attachments/20141231/1a0d18c0/attachment-0001
On Wed Dec 31 2014 at 2:45:57 PM Alex Kocharin <alex at kocharin.ru> wrote:
Firefox does parse
let=1
as illegal,
Under what circumstance? All of these function according to the spec:
let = 1;
console.log(let); // 1
var let = 1;
console.log(let); // 1
let let = 1; // SyntaxError
An HTML attachment was scrubbed... URL: esdiscuss/attachments/20150102/3d9474d4/attachment
It seems that in JSFiddle running on Firefox, let declaration is disabled. So this cannot explain.
I don't know why you'd say that, considering the fiddle works just fine. Open your developer console and you'll see the output. Note that I'm referring to Nightly.
Thanks for your note, I'm not testing it under Nightly. Did you test that the 'let' declaration is working properly in JSFiddle? It may not be enabled in web pages by default if the script doesn't declare to be javascript 1.7.
Gary is right: let
is disabled for web content in Firefox because our
version isn't spec-compatible enough yet. In the shell or chrome code,
where it is enabled, our behavior matches traceur's in that we treat the
given examples as errors, too.
From the specification I saw
yield
is being explicitly declared as an possible Identifier in non-strict mode, and therelet
,static
are parsed as identifier first. However, I did not see anyway to distinguishlet
identifier andlet
keyword.let=1
is parsed as illegal in traceur, and so doesstatic=1
. Is this a bug of traceur or it is intended? It would be incompatible in non-strict mode if this is intended. (And if this is intended, there will be no reason for keeplet
andstatic
non-reserved-word during lex stage)