[[Invoke]] and implicit method calls

David Bruant bruant.d at gmail.com
Wed Sep 18 13:54:54 PDT 2013


Le 18/09/2013 20:52, Tom Van Cutsem a écrit :
> 2013/9/18 David Bruant <bruant.d at gmail.com <mailto:bruant.d at gmail.com>>
>
>     An alternative to p3 and p4 would be to find a solution for the
>     interaction between private state and proxies that also works with:
>         Date.getMonth.call(myProxy)
>     A way that would make p1 work in essence (which very naturally you
>     listed as the first idea ;-) ).
>     Such a solution would also make invoke unnecessary.
>
>
> My example has nothing to do with private state per se. It's more 
> generally about forwarding proxies reliably rebinding |this| to their 
> target.
Are there other use cases than private state to rebinding |this| to the 
target?

... 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.
What does make the 0th argument (this binding) so special?

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130918/a2f6a3c4/attachment.html>


More information about the es-discuss mailing list