Clean scope

Mark S. Miller erights at google.com
Wed Aug 17 11:37:03 PDT 2011


On Wed, Aug 17, 2011 at 11:30 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com>wrote:

>
> On Aug 17, 2011, at 10:37 AM, Rick Waldron wrote:
>
>
>
> On Wed, Aug 17, 2011 at 12:36 PM, Allen Wirfs-Brock <allen at wirfs-brock.com
> > wrote:
>
>>
>> On Aug 17, 2011, at 9:14 AM, Juriy Zaytsev wrote:
>>
>> > What do you mean by "clean scope"? All scope chains have at least global
>> scope in them. Is that what "clean scope" chain would be — the one including
>> global scope only? That's pretty much what `Function` constructor does.
>>
>> or
>>  (null,eval)("function() { /*...*/ }");
>>
>
> This actually produces...
>
> syntax error, unexpected token
>
>
> works for me in FF6
>

According to ES5.1, the argument to eval is parsed as a Program. So there's
no reason to expect the above to work. Try

   (null,eval)("(function() { /*...*/ })");

instead.


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110817/36434cac/attachment.html>


More information about the es-discuss mailing list