Closed
Bug 609205
Opened 14 years ago
Closed 13 years ago
Future ECMAScript version: 'let' should not hoist
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jimb, Unassigned)
Details
At present, the following evaluates to 3: (function () { var x = 3; { x = 4; let x; } return x; })() However, in bug 553778 comment 14, Brendan says: > BTW, we resolved without yet spec'ing it even informally to change let in > Harmony to be like a declaration in C++, or like let* if you will, and not > hoist (yay!). I convinced everyone this is what people expect and not var-like > hoisting. So we should have a bug to implement this, and get on with it -- and > break JS1.[78]* compatibility too. So: SpiderMonkey should be changed so that the scope of a 'let' declaration is from the point of declaration to the end of the block. This would make the above evaluate to 4.
Reporter | ||
Comment 1•14 years ago
|
||
It might be a good idea to have a JSOPTION_STRICT and strict mode code warning issued for late lets that would capture new variables, starting now. And a Reflect-driven tool to search for code that would search for such cases!
Reporter | ||
Comment 2•14 years ago
|
||
Um, you know what I meant. 'night.
Updated•13 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•