[[Invoke]] and implicit method calls

Tom Van Cutsem tomvc.be at gmail.com
Sat Sep 21 02:52:08 PDT 2013


2013/9/21 Allen Wirfs-Brock <allen at wirfs-brock.com>

>
> On Sep 20, 2013, at 4:27 PM, Brandon Benvie wrote:
>
> On 9/20/2013 12:19 PM, Jason Orendorff wrote:
>
> I think .hasOwn() should be removed.
>
>
> Actually, taking the precedent of removing "getPropertyDescriptor", it's
> "has" that would be removed. The implementation of [[Has]] can easily walk
> the [[GetPrototype]] chain calling "hasOwn" on each until true or
> [[GetPrototype]] returns null. In fact, some agreed for a short time to
> *remove* the "has" trap specifically for this reason, but it was added back.
>
> https://mail.mozilla.org/pipermail/es-discuss/2012-November/026274.html
>
>
> [[Get]] and [[Set]] enable an exotic object to define its own property
> lookup semantics that isn't necessary the same as a simple "follow the
> [[Prototype]] chain until a matching own property is found".  For example,
> they could use some sort of multiple inheritance resolution algorithm.
> [[HasProperty]] is needed to allow an external client to check for the
> existence of a property using the same algorithm as [[Get]] and [[Set]].
>

Indeed, we decided in favor of keeping has() for the reasons Allen stated:
so that proxies can virtualize the proto-chain-walk consistently for
property access (get/set) as well as property lookup (in-operator), and
enumeration (for-in loop).

Put another way: with only the fundamental traps, all proto-chain-walking
happens external to the proxy, so the proxy cannot virtualize it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130921/c8121e48/attachment.html>


More information about the es-discuss mailing list