block scope + direct non-strict eval

Andy Wingo wingo at igalia.com
Tue Jan 31 06:30:01 PST 2012


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


More information about the es-discuss mailing list