Proxies: wrong "receiver" used in default "set" trap

Tom Van Cutsem tomvc.be at gmail.com
Fri Dec 21 11:10:23 PST 2012


2012/12/21 Allen Wirfs-Brock <allen at wirfs-brock.com>

>
> On Dec 21, 2012, at 7:01 AM, Tom Van Cutsem wrote:
>
> I think that with the provision of the Handler API, we provide Proxy
> authors with the same benefits than if we would add delegation to the ES6
> built-ins, without any required changes to existing internal methods for
> normal Objects.
>
>
> Yes, I generally agree that Handler is a way out of this.  But if that is
> our solution to the problem then I still think we have a usability issue
> with the current Proxy API design.
>

The usability cuts both ways: in the old Proxy API the fundamental vs.
derived trap distinction was baked-in, but you had to explicitly implement
*all* fundamental traps before you had a complete object abstraction.
Direct proxies are generally simpler to get started with, but there are
pitfalls when implementing only some of the traps.

We previously agreed that this is a known problem in OO frameworks. I'm not
sure whether there's a silver bullet here. I think the best we can do is to
provide adequate documentation of the dependencies, and point out the added
value of subclassing Handler.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121221/3735eb7d/attachment-0001.html>


More information about the es-discuss mailing list