On Thu, Aug 28, 2008 at 12:14 PM, Dave Herman <[EMAIL PROTECTED]> wrote:
>> For what value of "global" should the "global" keyword be global? };->
>
> I interpreted Erik's point to be that the binding of `this' is not lexically
> scoped, so it would be useful to have a lexically scoped variable initially
> bound to the global object. IOW, if I write:
>
>    global.print("blah blah blah")
>
> and the same refactoring:
>
>    (function() {
>         global.print("blah blah blah")
>    })()
>
> continues to work the same.

Cool. Would there be a 'global' for each module (for some
interpretation of "module" but assuming each module has its own
separate top-level lexical scope, as appears to be the growing
concensus)?

> But there's no need for a special keyword or anything like that.

Would that really satisfy Erik's use case? He seemed to think that
doing, at the top level --

  var global = this;

  function foo() {
    global.bar = 3;
  }

is vulnerable to some ${person} going --

  function foo() {
    var global = /* something else */
    global.bar = 3; /* now not the *real* global; system fails! */
  }

?

Ihab

-- 
Ihab A.B. Awad, Palo Alto, CA
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to