Re: variable declarations shadowing named properties on window

Travis Leithead:
> It seems like moving the GSP functionality to the prototype should only happen for
> [ReplaceableNamedProperties] and only for named properties (not indexed properties).

Yes, only for [ReplaceableNamedProperties].  No need to complicate 
HTMLCollections, etc.

One thing that moving indexed properties to the prototype chain would 
allow is allowing a JS implemented window object to be a non-Proxy 
object.  Is that beneficial?

> Let's at least not create a new object in the prototype chain, but rather re-use one
> that is already created for this purpose, such as the Window.prototype object.

1. [Object.prototype] <- [named props] <- [Window.prototype] <- [window]
2. [Object.prototype] <- [Window.prototype] <- [named props] <- [window]
3. [Object.prototype] <- [Window.prototype + named props] <- [window]

I'm advocating for (2) over (3) for the same reasons as over (1) -- it 
seems odd to me to put instance specific properties on objects in the 
prototype chain that multiple instances would inherit from.  (And yes, I 
know windows are singletons here -- it's more of an aesthetic concern.)

Are you concerned about web compatibility issues of having 
Object.getPrototypeOf(window) not being Window.prototype?  Or something 
else?

Received on Saturday, 7 January 2012 04:29:12 UTC