Proxying built-ins (Was: [[Invoke]] and implicit method calls)
Tom Van Cutsem
tomvc.be at gmail.com
Thu Sep 26 02:03:27 PDT 2013
2013/9/25 Allen Wirfs-Brock <allen at wirfs-brock.com>
> On Sep 25, 2013, at 3:01 AM, David Bruant wrote:
> Builtins are easy, because it's very clear which method is expected to
> work with which object; there is a clear definition of what an "instance"
> is and that can be tracked internally. Also, the auto-unwrapping can be
> done safely, because it's done internally. None of these two are true for
> userland private state.
> How is this clear at the level of specify the behavior of MOP operations
> for Proxy instances? What is it that distinguishes a function that has
> such dependencies from one that doesn't.
> Also, one of the early goals of Proxy was to support self hosting of
> built-ins. Saying that the Proxy MOP implementation has special knowledge
> of all built-in methods would not be supportive of that goal.
My proposal would not require the Proxy MOP to know about all the
built-ins. Rather it's the other way around: all the built-ins for which
passing in a proxy should work, should know about proxies and un-wrap them.
But your and David's point is well-taken: this would be an ad hoc mechanism
that might work for just the ES6 built-ins, but it does not scale easily
beyond those. I withdraw my proposal.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss