The global object as the "global scope instance object"

Mark S. Miller erights at
Fri Jan 20 09:09:29 PST 2012

On Fri, Jan 20, 2012 at 5:55 AM, Andreas Rossberg <rossberg at>wrote:

> Regarding scope pollution, I think this is best solved by making the
> global object be a fresh empty object that has the object containing
> all primordials as its prototype.

<very pedantic -- you've been warned>
Just a pedantic terminology point for now: Presumably you mean "global
primordials other than the global object itself". Object.prototype.toString
is a primordial, but presumably there is no direct binding from your
proposed object to Object.prototype.toString. (An alternate interpretation
of your "containing" might be "reachable", in which case it would apply to
Object.prototype.toString, but IMO that's a confusing way to specify

I would classify Object as a global primordial, because it is initially
bound, according to ES specification, to the global variable named "Object".

The global object itself is bound to top level "this", which isn't exactly
a global variable, so it is unclear whether the unqualified phrase "global
primordials" should include it. Hence the qualification.

Although the global object is often also bound to a global variable like
"window", this does *not* make it a global primordial, since that binding
derives from the hosting environment rather than any ES spec.

Were we to adopt your proposal, this new object would itself be a new
primordial, reachable directly from the global object but not named by any
global variable. Indeed, it would be one of the very few primordials not
named by a naming path rooted in a global variable. (Another example is the
ThrowTypeError object of 13.2.3. Are there any others? I can't think of
</very pedantic -- you've been warned>

Substantive comments later after I've mulled over your very interesting

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list