[[Invoke]] and implicit method calls

Till Schneidereit till at tillschneidereit.net
Tue Sep 10 03:55:25 PDT 2013


On Tue, Sep 10, 2013 at 1:23 AM, Jason Orendorff
<jason.orendorff at gmail.com>wrote:

> On Mon, Sep 9, 2013 at 4:50 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
> 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.
>
>
When implementing the [[Invoke]] trap in SpiderMonkey, I went with the
assumption that it should apply to all calls of the forms `receiver.fun()`
and `receiver["fun"]()`. Jason pointed out that `with (receiver) { fun() }`
should be caught, too. Doing anything else would make for a surprising
restriction of proxies' capabilities compared to manually overriding
methods, IMO.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130910/7b0f479c/attachment.html>


More information about the es-discuss mailing list