The global object should not be the "global scope instance object"

Brendan Eich brendan at
Fri Jan 27 14:52:54 PST 2012

Axel Rauschmayer wrote:
> I’m wondering: Won’t modules make many of these things much easier, 
> given that global state will usually be encapsulated per module? As a 
> programmer, I’d try to get out of global scope and into module scope 
> as quickly as possible (similar to people using IIFEs now). Wouldn’t 
> that suggest migrating some and browser mechanisms to modules?

No. Downrev browsers will mean non-strict top level code will be around 
for a good while. Not everyone will get an ES6 to ES5 compiler. We do 
not want only "use a module" if we can also say "let or const at 
top-level opts into lexical bindings."

The question then is: what should let and const at top-level do? That 
leads to global-object (not really tenable with let and const, IMHO), 
vs. single top-level vs. nesting vs. isolated. I still incline toward 
isolated but see the appeal of nesting.


More information about the es-discuss mailing list