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

Brendan Eich brendan at
Mon Nov 12 13:20:09 PST 2012

Tom Van Cutsem wrote:
>     Another potential consistency issue is between [[HasOwnProperty]]
>     and [[GetOwnProperty]].  That could be eliminated by combining
>     them into one operation:
>     [[GetOwnPropety]](name, descriptorNeeded) -> descriptor | boolean
>     | undefined
>     If descriptorNeeded is true it acts as the current
>     [[GetOwnProperty]]. If descriptorNeeded is false it acts as the
>     current [[HasOwnProperty]].
>     At the handler-level it makes it impossible to override
>     "hasOwn"without also overriding "getOwnPropertyDescriptor"
> I understand the goals, but I'm not a big fan of fusing traps like 
> this. It trades complexity on one level (inconsistencies between 
> traps) for complexity on another level (if-tests in fused trap bodies 
> to determine what type of value to return).

Agreed. That kind of return value overloading has a smell.


More information about the es-discuss mailing list