Le 18/09/2013 20:52, Tom Van Cutsem a écrit :
2013/9/18 David Bruant <[email protected] <mailto:[email protected]>>
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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss