block scope + direct non-strict eval
Sam Tobin-Hochstadt
samth at ccs.neu.edu
Tue Jan 31 08:27:31 PST 2012
On Tue, Jan 31, 2012 at 9:30 AM, Andy Wingo <wingo at igalia.com> wrote:
> 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.
Instead, I would say that TC39 wants to eliminate the concept of "classic mode".
> If so, can someone say what these expressions would evaluate to, or the
> errors they would raise:
I don't think we've talked about the behavior of direct |eval| on
statements with |let|, but here's what I would hope we'd do:
> (function (){eval("let x = 10"); return x;})()
ReferenceError
> (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("let x = 10"); return x;}}})()
20
> (function (){let x = 20; eval("var x = 10"); return x;})()
10
--
sam th
samth at ccs.neu.edu
More information about the es-discuss
mailing list