Proposal: opt-out local scoping

Erik Arvidsson erik.arvidsson at
Thu Aug 28 10:45:54 PDT 2008

global as speced for ES4 was equivalent to this in global scope.

There are several use cases for having global.  Most of them involves
some kind of reflection.  For example finding all global functions
that start with 'test' or finding out if there is an object called
'google.gears.factory'.  Another common case that we use a lot is to
export a named property to the global scope:

global['foo'] = innerFoo;

On Thu, Aug 28, 2008 at 10:07,  <ihab.awad at> wrote:
> On Thu, Aug 28, 2008 at 9:44 AM, Erik Arvidsson
> <erik.arvidsson at> wrote:
>> I hope we can still have "global" in Harmony.  It is ugly to have to do:
>> const global = this;
>> and rely on that no one moves that code into a closure with a different "this".
> For what value of "global" should the "global" keyword be global? };->
> If you are inside some separately loaded compilation unit, does
> "global" mean global to the module?
> Also, you seem to be asking for an explicit way to say, "this variable
> does not respect Tennent correspondence; I know I am doing this and I
> have a good reason" --
> What's the use case/good reason?
> Ihab
> --
> Ihab A.B. Awad, Palo Alto, CA


More information about the Es-discuss mailing list