On Thu, Oct 4, 2012 at 12:31 AM, Mark S. Miller <erig...@google.com> wrote:
> > On Wed, Oct 3, 2012 at 3:16 PM, Šime Vidas <sime.vi...@gmail.com> wrote: > >> On Wed, Oct 3, 2012 at 7:05 PM, François REMY >> <fremycompany_...@yahoo.fr>wrote: >> >>> I think that what he meant is that we know for sure in which scope we >>> can find the property/variable. That the propery exists or not in the that >>> scope is another issue. >>> >> >> So, it doesn't matter that the global environment is dynamic (as in >> bindings can be added/removed dynamically), since it's the top-most >> environment. Only the nested (function) environments must be static, and if >> they are, i.e. if we know which bindings are defined in each function >> environment (in the scope chain), then we can safely assume that a name >> that doesn't exist in any of those function environments, can only either >> be a global binding, or a name that doesn't exist in any environment. Did I >> get this correctly? >> > > Exactly correct. Thanks for the clarification! > Well, thank you for your excellent video. The dynamic scopes in the default language are a disaster... I've just written a short code example (see below) which demonstrates this. Thank goodness ES5 Strict is statically scoped. :-) // global code this.foo = 1; (function () { eval('var foo = 2'); with ({ foo: 3 }) { foo // => 3 delete foo; foo // => 2 delete foo; foo // => 1 delete foo; foo // ReferenceError } }());
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss