Removing Proxy hasOwn() trap (Was: [[Invoke]] and implicit method calls)

Tom Van Cutsem tomvc.be at gmail.com
Tue Sep 24 05:23:10 PDT 2013


[forking from [[invoke]]-thread for clarity]

2013/9/23 Jason Orendorff <jason.orendorff at gmail.com>

> On Mon, Sep 23, 2013 at 3:40 AM, Tom Van Cutsem <tomvc.be at gmail.com>
> wrote:
> > To me hasOwn() is as much a primitive as e.g. Object.keys().
> >
> > The only odd thing about it is that it lives on Object.prototype rather
> than
> > as a static method on Object.
> >
> > I don't see the inconsistency, unless you would also want to remove
> > Object.keys() because it can be expressed in terms of gOPN + gOPD.
>
> But Tom, there already is no trap for Object.keys()! It's specified in
> terms of [[OwnPropertyKeys]] and [[GetOwnProperty]].
>

My bad. I was still looking at the wiki page, which is outdated in that
respect.

Given the Object.keys precedent, we could consider removing hasOwn() and
re-specifying it in terms of getOwnPropertyDescriptor() !== undefined.

More object allocation, but the same holds true for removing the "keys"
trap.

Allen: would the removal of the hasOwn() trap imply that we can drop the
[[HasOwnProperty]] internal method altogether?

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


More information about the es-discuss mailing list