[[Invoke]] and implicit method calls

Jason Orendorff jason.orendorff at gmail.com
Tue Sep 10 10:45:35 PDT 2013

On Tue, Sep 10, 2013 at 11:11 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
> Having to create a new bound function on every method call seems too expensive.

Only for proxy method calls, and it's easily optimized away in the
default case (i.e. there is no .getMethod handler method).

(As an aside, exchanges like the above have gotten so frequent they
are beginning to feel a bit pro forma. I don't mean to sweep all
performance concerns into one pile here.)

>  But what about:
>  6. Let method = O.[[Get]](P).
>  7. ReturnIfAbrupt(method).
>  8. If IsCallable(method) is false, throw a TypeError.
>  9. Return O.[[InvokeFunction]](method,O, args).
> Using [[InvokeFunction]] the Proxy still mediates the [[Call]] to method but it is assume the [[Get]] step has already been performed and has produced method.

This is appealing. There are a few things [[GetMethod]] can do that
this can't: [[InvokeFunction]] can't be used to make a proxy that
mimics the behavior of __noSuchMethod__, for example. I don't think it
can mimic ActionScript 3 Proxy.callMethod either.

If [[InvokeFunction]] is deemed powerful enough, I'm all for it.


More information about the es-discuss mailing list