Proposal: opt-out local scoping

Dave Herman dherman at ccs.neu.edu
Thu Aug 28 12:10:01 PDT 2008


> Dave,  I really like the lexical scope proposal.  However,  I do find
> the sections regarding the global a bit confusing.  Are the following
> assumptions correct?

If we assume there is no standard library function called `print'...

> this.print = function(s) { ... };

Then this dynamically adds a property `print' to the global object...

> {
>   use lexical scope;
>   this.print('OK');

This dynamically looks up the `print' property in the global object and 
succeeds...

>   print('FAIL');

This statically looks up `print' in the lexical environment and fails.

> }

If that's what you meant, then yes.

Dave



More information about the Es-discuss mailing list