[[Invoke]] and implicit method calls

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

2013/9/18 David Bruant <bruant.d at gmail.com>

>  ... I just realized that in your examples, the private state is stored
> in a weakmap which requires target identity. If I recall, the original
> problem wasn't so much with weakmaps, but rather with Date instances which
> is slightly different.
> If solving weakmap lookups via |this| binding is worth solving, maybe we
> need to start considering solving weakmap lookups via the receiver of get
> and set traps, etc. As well as weakmap lookups via 1st, 2nd, 3rd, etc.
> argument.

We already have a solution to this: membranes do exactly the right
wrapping/unwrapping for all arguments (including |this|, return values, and
thrown exceptions).

> What does make the 0th argument (this binding) so special?

The fact that many OO programmers don't consider |this| to be an argument
and depend on it being of a particular "type". The methods on many of JS's
built-ins are a good example. But this is getting philosophical. The fact
remains that we should make it easy for proxies to translate
|proxy.method(...args)| into |target.method(...args)| calls.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130919/55b4854f/attachment.html>

More information about the es-discuss mailing list