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

Re: "var" declarations shadowing properties from Window.prototype

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Sat, 11 Aug 2012 18:41:04 -0700
Cc: Brendan Eich <brendan@mozilla.org>, Boris Zbarsky <bzbarsky@mit.edu>, public-script-coord@w3.org, es-discuss@mozilla.org
Message-Id: <912BE5A7-7440-4DE5-84E3-35B4A2A65A42@wirfs-brock.com>
To: Cameron McCormack <cam@mcc.id.au>

On Aug 11, 2012, at 6:12 PM, Cameron McCormack wrote:

> Jonas Sicking:
>>> Webkit also puts attributes on objects for non-globals, but I'm not
>>> promoting that behavior. Nor do I know of any benefits regarding web
>>> compatibility that comes with that behavior.
> 
> Brendan Eich:
>> Ok, that's what I was getting at. It may be that this is just historical
>> consistency for all objects, no global exception, but sounds like we are
>> agreeing that the global object needs an exception ("own" promotion of
>> attributes and methods) in WebIDL.
> 
> Before ES5 was out, Web IDL put properties for IDL attributes on instances, exposed via special [[Get]] and [[Put]] behaviour.  That was pretty much what implementations were doing.  Once ES5 standardised accessor properties, we had the opportunity to make IDL attributes less magical -- which was argued for pretty strongly by TC39 folks, before Proxies came along.  Now perhaps I didn't consider closely enough the possibility of this being a breaking change (especially on the global object), but it seemed everyone was happy enough with moving in that direction.  And I think it's a cleaner model for shared properties with getter/setter behaviour, anyway, and gives you the opportunity to monkeypatch them that the special [[Get]] and [[Put]] behaviour couldn't.
> 
> Which is to say that I think we should still push forward with attributes-as-accessor-properties-on-prototypes at least for objects other than the global object.

Exactly, attributes-as-accessors-on-prototypes seems to work great for everything other than the global object.  But for the global object, attributes and operators are essentially equivalent to ES declared or built-in  global variables/functions.   The global object has a special role. It's fine to special case its treatment of WebIDL attributes and operators.  

Allen
Received on Sunday, 12 August 2012 01:41:41 UTC

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