July TC39 meeting notes, day 1

Tom Van Cutsem tomvc.be at gmail.com
Fri Aug 12 04:53:19 PDT 2011


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

>
> This seems to miss Sean's point that receiver is never other than the proxy
> for get and set. That follows from how native object [[Get]] works in ES5.
>

You're right. Using the "get" trap as an example was silly, since it already
has access to receiver, which is the proxy. Your comment made me revisit all
derived traps again, and I think I found a compelling and easy-to-understand
rule for determining whether or not a trap needs access to proxy/receiver:
if the trap deals with inherited properties, it needs access to |proxy|.

Using that rule, the following traps require access to |proxy|:
get, set, getPropertyDescriptor, getPropertyNames, has, enumerate
(incidentally, all of these traps are or can be made derived)

All other traps deal only with "own" properties, and do not need |proxy|:
getOwnPropertyDescriptor, getOwnPropertyNames, defineProperty, delete, fix,
hasOwn, keys

getPropertyDescriptor and getPropertyNames require access to |proxy| to walk
the prototype-chain. The default behavior of get, set, has and enumerate is
specified in terms of either or both of these traps, so they also need
access to |proxy|. Note that get and set depend on |proxy| for two reasons:
1) to correctly set |this| for accessors, 2) to be able to lookup a property
on the prototype chain (via |Object.getPropertyDescriptor(proxy, name)| )

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110812/fa23c0ae/attachment.html>


More information about the es-discuss mailing list