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

Tom Van Cutsem tomvc.be at gmail.com
Wed Nov 14 12:11:20 PST 2012


2012/11/14 Allen Wirfs-Brock <allen at wirfs-brock.com>

>
> On Nov 14, 2012, at 1:22 AM, Tom Van Cutsem wrote:
>
> Given approach 1) she can look at the full list of traps (e.g. the list at
> the top of <http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies>)
> and quickly figure out that she must implement the "has" trap.
>
>
> But this might have effects far beyond just the in operator and it still
> might not work.  Unless it is explicitly specified (in an accessible place)
> how does she know that  "in" uses "has" instead of "hasOwn" or
> "getOwnPropertyDescriptor" pus an explicit proto climb? Also what other
> language features depend upon "has"?    You can't just implement "has" for
> the sole effect of intercept the "in"-operator.
>

Agreed, the MOP methods serve multiple purposes, with many different
operators potentially triggering the same MOP method. What I was getting at
was that the derived traps enable more direct mappings for some operations
that can be readily understood by ES5 programmers.

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


More information about the es-discuss mailing list