W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

Re: variable declarations shadowing named properties on window

From: Cameron McCormack <cam@mcc.id.au>
Date: Sat, 07 Jan 2012 15:28:21 +1100
Message-ID: <4F07C9E5.8000308@mcc.id.au>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, Allen Wirfs-Brock <allen@wirfs-brock.com>, Ojan Vafai <ojan@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Ian Hickson <ian@hixie.ch>, Jeff Walden <jwalden@mit.edu>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC