[Harmony proxies] Thoughts on the almost-dead "receiver" argument

David Bruant david.bruant at labri.fr
Sat Sep 24 14:48:09 PDT 2011

Le 24/09/2011 22:49, Brendan Eich a écrit :
> On Sep 23, 2011, at 11:18 AM, David Bruant wrote:
>> My intuition is that WebIDL imposes getter/setters since it is the only
>> way in ES5.1 to have a per-instance behavior while intuition would
>> rather be to describe all properties as regular data properties which is
>> what all these getter/setters emulate anyway (see getter and setter
>> definitions at http://www.w3.org/TR/WebIDL/#es-attributes).
> Really, though, are the WebIDL attributes all accurately representable by data properties without trapping magic that normalizes at least on set? DOM attributes do convert to a target type for the attribute. Data properties can' do that in JS.
Data properties of regular objects can't. Data properties of proxies
could (because they are made up dynamically). But I've been thinking
about this more and it wouldn't work. If the programmer ever sets
"configurable" to true for a data property on the prototype, all objects
would inherit the same (last) value which is not what we'd want.
The proxy could reject the non-configurability (but this is hacky) or
turn the property as a non-configurable getter/setter (which has more or
less no benefit over having a getter/setter pair in the first place).
So, my previous wouldn't really solve the problem I mentionned.

Yet, I still think that not having at the object-level the equivalent of
what we can do at property-level (with getter/setters changing things
based on the receiver object) would be a miss.


More information about the es-discuss mailing list