On Wed, Oct 3, 2012 at 10:05 AM, 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, in the code “function getOoops(t) { t(); return function() { return > ooops; } }” we know statically that the scope where the “ooops” variable is > defined is the global scope. At runtime, we just need to do > “globalScope.get(‘oops’)" to retreive the value (or throw). > Exactly. > In non-strict ES, the “t” function may be eval, and eval could add a > “oops” variable in the parent function getOoops. So, we don’t know at > compilation if “ooops” belong the the global scope of from the function’s > scope (we can only find that out at runtime). > > As clarified in the rest of the thread. If "t"'s value is the original eval function, this will still be an indirect call. But in non-strict function getOoops(str) { eval(str); return function() { return ooops; } } we no longer no which ooops this code refers to. > > > *From:* Šime Vidas <sime.vi...@gmail.com> > *Sent:* Wednesday, October 03, 2012 6:41 PM > *To:* es-discuss@mozilla.org > *Subject:* Is ES5 Strict a fully statically scoped language? > In the talk "Changes to JavaScript, Part 1: EcmaScript 5", Mark Miller > states that ES5 Default contains four static scope violations (direct link: > http://www.youtube.com/watch?v=Kq4FpMe6cRs&t=42m53s). He also states that > ES5 Strict corrects these violations, making ES5 Strict is a statically > scoped language. I don't understand how that can be true, since it is > possible to dynamically add bindings to the global environment by creating > new global properties (during code evaluation). Isn't this a static scope > violation, too? > > -- Šime Vidas > > ------------------------------ > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss