+1 for refactoring to use [[Invoke]] for most of these.

One reservation about the use of [[Invoke]] to call proxy traps (i.e.
functions on handler objects): the alternative pattern of first probing
with HasProperty destroys the "double lifting" pattern, which depends on
the proxy only ever performing 1 type of operation (a property access) on
its handler.

(double lifting is a pattern whereby the handler object is itself a proxy.
It allows you to write very generic proxies that only need to implement a
single "get" trap. See <
http://soft.vub.ac.be/~tvcutsem/invokedynamic/assets/proxies.pdf> section
4.5 for details.)

If we refactor to use [[HasProperty]] + [[Invoke]] to call traps, the
double lifting pattern requires implementing both the has() trap and the
get() trap. Not fatal, but I just want to point it out.

Regards,
Tom


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

> On Mon, Sep 9, 2013 at 4:50 PM, Allen Wirfs-Brock <[email protected]>
> wrote:
> > I'll take a look at it.  My first reaction is that this sounds like a
> good idea.
>
> A lot more can be found by searching for [[Call]]:
> - the call to @@toPrimitive from ToPrimitive (in 7.1.1)
> - the call to @@hasInstance from instanceofOperator (in 12.8.1)
> - the call to .toISOString from Date.prototype.toJSON (in 20.3.4.37)
> - the call to .join from Array.prototype.toString (in 22.1.3.27)
> - the call to .set from the Map constructor (in 23.1.1.1)
> - the call to .add from the Set constructor (in 23.2.1.1)
>
> and at that point I stopped looking.
>
> -j
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to