[[Invoke]] and implicit method calls

Tom Van Cutsem tomvc.be at gmail.com
Wed Sep 18 12:17:01 PDT 2013


2013/9/18 Tom Van Cutsem <tomvc.be at gmail.com>

> AFAICT, performance arguments aside, the question of whether or not to
> include invoke() boils down to whether you prefer the p3 or p4 pattern.
>

I just figured out that the p3 example is "flawed" in the sense that:

p3.m.call(p3) // does not re-bind |this|, so returns undefined rather than
42

p4 handles this fine:

p4.m.call(p4) // 42

However, it's not clear to me that code such as the above needs implicit
|this|-rebinding.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130918/e289a275/attachment.html>


More information about the es-discuss mailing list