July TC39 meeting notes, day 1

Tom Van Cutsem tomvc.be at gmail.com
Thu Aug 11 11:39:39 PDT 2011

2011/8/8 Brendan Eich <brendan at mozilla.com>

> Good point. So we are not going in a circle -- we're spiraling toward a
> conclusion which is not that proxy should be provided to all traps, or none.
> The get and set derived traps are special: they call through to accessors.
> (Proxy gurus, please check me if I'm misstating this. We need to build up
> non-guru understanding of the full design's rationale.)

Indeed, get and set are special because they call through to accessors. But
in that mindset, we can think of getPropertyDescriptor and getPropertyNames
as special derived traps because they walk the prototype chain (requiring
access to the proxy, or more precisely: the proxy's prototype). Why would we
pass |proxy| to get/set but not to getPD/getPNs?

So, counting getPD and getPNs as derived, that leaves us with four derived
traps that require access to the proxy. If we leave it at these four, we can
make a note in the documentation explaining why they need |proxy|. Or, we
could generalize and provide |proxy| as an argument to all traps. My feeling
is that developers will find this natural, since the Proxy API does allow
the creation of multiple proxies that share the exact same handler object.
The additional |proxy| argument allows such a shared handler object to
naturally tell apart the proxies for which it is used.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110811/1271a97d/attachment.html>

More information about the es-discuss mailing list