2011/8/17 John J Barton <johnjbar...@johnjbarton.com>: > On Wed, Aug 17, 2011 at 9:14 AM, Juriy Zaytsev <kan...@gmail.com> 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. > > No, I mean a scope with JavaScript built-ins only, no 'host' > functions, no |window| properties. > > function walkTheWalk(position) { > "use empty"; > var from = parent.location; // error, should have said > position.parent, but it works?!? > }
Haven't there been various proposals/schemes for an eval that takes an object to serve as the scope root as the second argument? http://dmitrysoshnikov.com/ecmascript/chapter-1-execution-contexts/ > In SpiderMonkey implementation (built into Firefox, Thunderbird), up to > version 1.7, it is possible to pass a calling context as a second argument > for eval function. This violated closures in abominable ways, but it could be made to respect closures. If that second argument were explicitly null, then using an object containing only the builtins as defined at interpreter start, would get these semantics. _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss