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

2013/9/23 Jason Orendorff <[email protected]>

> On Mon, Sep 23, 2013 at 3:40 AM, Tom Van Cutsem <[email protected]>
> 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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to