On Jan 31, 2012, at 12:22 PM, Andy Wingo wrote:

> On Tue, 2012-01-31 at 10:13 -0800, Brendan Eich wrote:
>>>>>  (function (){let x = 20; eval("var x = 10"); return x;})()
>>>> 10
>>> 
>>> Surely a SyntaxError, as the var x conflicts with the let x at the
>>> function-level scope?
>> 
>> Oops, you're right. This is non-strict direct eval, so the var hoists 
>> and collides with the 'let'. Thanks!
> 
> Relatedly:
> 
>  (function (){ { let x = 20; eval ("var x = 10"); } return x;})()
> 
> SyntaxError because the "var x" gets hoisted past the "let x" ?

absolutely

Allen



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to