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

Re: variable declarations shadowing named properties on window

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 23 Jan 2012 15:13:24 +0100
Message-ID: <4F1D6B04.50004@mit.edu>
To: Cameron McCormack <cam@mcc.id.au>
CC: Travis Leithead <travis.leithead@microsoft.com>, 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>
On 1/23/12 2:10 AM, Cameron McCormack wrote:
> Having the named properties live elsewhere does effectively make
> [ReplaceableNamedProperties] usable only for singletons like Window
> (since otherwise it would be weird if there were multiple instances with
> an object in their proto chain that returns named properties for all
> instances at once), but that's probably not a big deal; we shouldn't be
> encouraging spec writers to use [ReplaceableNamedProperties] anyway.

The main use case is for global objects, so you can have undeclared 
global variables work "right".  And global objects are by assumption 
singletons.

> But to be honest, I'm not strongly attached to this over your suggestion
> of putting the properties on Window.prototype itself, if we are not
> having a separate named properties object exist as window.__proto__.
> Boris, apart from being different from what Gecko does now, do you
> forsee any problems with sticking the named properties on Window.protoype?

In at least Gecko I suspect this would make calling DOM methods on the 
window slower because the normal JS optimizations would be disabled for 
Window.prototype.  We can make it work, obviously, but it would not be 
my preferred choice.

I can't speak to whether any other UAs would have issues with it.

-Boris
Received on Monday, 23 January 2012 14:14:04 UTC

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