sloppy-mode let more incompatible than spec lets on (due to automatic semi-colon insertion) #259
Labels
normative change
Affects behavior required to correctly evaluate some ECMAScript source text
In ES3/5, the code
x=true;eval("var let;let\nx=false");x
evaluates tofalse
, while in ES6 the same code evaluates totrue
, as in earlier versions of ECMAScript automatic-semicolon insertion intervenes and breaks what is now a LexicalDeclaration into two separate ExpressionStatements. This seems like something that should be documented in Annex E.FWIW, I can see that 13.5 under Annex E tries to talk about the case of a StatementListItem which begins with "let [", but the incompatibility is actually more pervasive (though likely harmless). Also, I will point out that I can actually see someone formatting their (ECMAScript 6) code in an ambiguous way: putting variables on their own lines after the let, such as "let\n\tx=0,\n\ty=1".
Legacy ECMAScript:
ECMAScript 2015:
The text was updated successfully, but these errors were encountered: