block scope + direct non-strict eval

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Feb 2 08:06:11 PST 2012


On Feb 2, 2012, at 2:07 AM, Claus Reinke wrote:
> 
>>> and embed the assignment in an eval:
>>> 
>>>> function f(a) {
>>>>   eval("arguments[0]=2");
>>>>   return a
>>>> }
>>>> print(f(1));  // 2 or 1?
>> 
>> same as above, same as ES5
> 
> But if I put this in a module, f will be in extended strict mode, while
> the eval code will default to non-extended non-strict mode, right?
> Which wouldn't quite be the same as in the version without eval.

Per ES5 10.1.1, the code will be strict code--direct eval from strict code always processes the eval coce as strict code.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120202/41f693f4/attachment.html>


More information about the es-discuss mailing list