[[Invoke]] and implicit method calls

Tom Van Cutsem tomvc.be at gmail.com
Thu Sep 19 01:53:59 PDT 2013


2013/9/19 Allen Wirfs-Brock <allen at wirfs-brock.com>

> I really don't think we need to debate this much longer.  We just need to
> stay the course with [[Invoke]] and I can update the spec. to replace
> [[Get]]+[[Invoke]] rather than [[Get]]+[[Call]] for this conditional
> situations. I may also added add a note suggesting that the extra [[Get]]
> can be eliminated.
>

Refactoring [[Get]]+[[Call]] to [[Get]]+[[Invoke]] seems fine by me. It
better expresses the intent, and the change should only be observable to
proxies.

Re. the fact that |proxy.method.call(proxy)| would not re-bind |this|: I've
come to think that if |this|-rebinding is crucial to your proxy's use case,
you probably need to go "all the way" and just use membranes. Membranes
contain all the necessary logic to rebind |this| as well as any other
parameters.

That said, I believe we could do strictly without invoke(), but given that
method invocation is so primary to JS, I believe we make the right choice
by exposing it in the MOP.

By comparison, we also added a has() trap to trap the in-operator, while we
could have also just triggered a series of more fundamental traps to figure
out the result, and the in-operator is far less common than method
invocation in a typical JS program.

Regards,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130919/c17d5f0b/attachment.html>


More information about the es-discuss mailing list