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

Tom Van Cutsem tomvc.be at gmail.com
Mon Sep 26 05:35:53 PDT 2011

2011/9/24 David Bruant <david.bruant at labri.fr>

> 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.

Would it really? Javascript data properties are currently simple and easy to
understand. In pure JS, it's not possible to have a data property's value
depend on the receiver. If you need such a thing, you resort to accessors.
The good thing about this is that the "magical" behavior of the property
shows up via the Reflection API (getOwnPropertyDescriptor will return an
accessor property descriptor), warning the client about the property's

If proxies would allow data properties to depend on the receiver, that may
lead library and/or spec writers away from using accessors, which is not
necessarily beneficial. I realize it's a fairly weak argument, since proxies
make the behavior of all (configurable) properties magical. Still, proxies
currently can't easily emulate receiver-dependent data properties.

Of course, changing the inheritance-related traps to accept an additional
receiver argument is not a big deal, so if there are good use cases, why
not. So far though, I don't see what is wrong with WebIDL using accessors.
It seems accessors are the right tool for the job in this case.

The problematic case would be one where WebIDL would require
receiver-dependent data properties.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110926/2e1db1b4/attachment.html>

More information about the es-discuss mailing list