Clean scope

John J Barton johnjbarton at johnjbarton.com
Wed Aug 17 10:38:43 PDT 2011


On Wed, Aug 17, 2011 at 9:14 AM, Juriy Zaytsev <kangax at 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?!?
}

> --
> kangax
>
> On Wed, Aug 17, 2011 at 11:50 AM, John J Barton
> <johnjbarton at johnjbarton.com> wrote:
>>
>> JavaScript's ability to close over variables in nesting scopes
>> sometimes surprises me. I'd like to be able to say "function uses a
>> clean scope". Is there something like this in the works? Or maybe it
>> exists?
>> Thanks,
>> jjb
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>
>


More information about the es-discuss mailing list