block scope + direct non-strict eval

Brendan Eich brendan at mozilla.org
Tue Jan 31 08:31:29 PST 2012


What Sam said. There's no need to hork 'let' just because of a lack of 
version or strict-mode opt-in. It's still sane, unlike 'var'. Leibniz 
agrees ;-).

/be

> Andy Wingo <mailto:wingo at igalia.com>
> January 31, 2012 6:30 AM
> Hello ecmascriptians,
>
> I hear that TC39 wants to allow let and const into "classic mode". This
> sounds like a bad idea to me, but, ok.
>
> If so, can someone say what these expressions would evaluate to, or the
> errors they would raise:
>
> (function (){eval("let x = 10"); return x;})()
>
> (function (){var x = 20; eval("let x = 10"); return x;})()
>
> (function (){let x = 20; eval("let x = 10"); return x;})()
>
> (function (){let x = 20; { eval("let x = 10"); return x;}})()
>
> (function (){let x = 20; eval("var x = 10"); return x;})()
>
> (function (){ { let x = 20; { eval("let x = 10"); return x;}}})()
>
> As Leibniz would have it, let us calculate.
>
> Andy
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list