"var" declarations shadowing properties from Window.prototype

Cameron McCormack cam at mcc.id.au
Sat Aug 11 18:12:54 PDT 2012


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.


More information about the es-discuss mailing list