Do we really need the [[HasOwnProperty]] internal method and hasOwn trap

Brendan Eich brendan at mozilla.org
Tue Nov 13 22:35:41 PST 2012


Erik Arvidsson wrote:
> On Tue, Nov 13, 2012 at 3:25 PM, Tom Van Cutsem <tomvc.be at gmail.com 
> <mailto:tomvc.be at gmail.com>> wrote:
>
>
>     So, my proposal: let's revert the fundamental traps of Handler to
>     become abstract methods again. This forces subclasses of Handler
>     to provide all fundamentals at once, avoiding the footgun.
>
>
> Maybe we should skip the derived traps for ES6 and see if the extra 
> allocation really becomes an issue in reality? This way we are keeping 
> the API smaller and the risk of errors lower. We can always add the 
> derived traps later, can't we?

Allocations always matter, in my experience -- even with V8.

Also Tom's point about precision counts, independent of allocations. A 
"hasOwn" test in the MOP should not call the same thing that 
Object.getOwnPropertyDescriptor calls, if we can help it -- especially 
without a flag argument to hint the difference, but that flag argument 
is blecherous anyway.

/be


More information about the es-discuss mailing list