On defining non-standard exotic objects

Brandon Benvie brandon at brandonbenvie.com
Wed Jan 9 16:03:22 PST 2013


This was basically what I was getting out, even if it was wrong in the idea
of using those specific internal methods rather than the higher level
methods you describe. Proxies are better than the completely magical
implementations that were used in the past, in that they will end up, by
default, closer to internally consistent. But they are still capable of
being completely inconsistent, and it doesn't take very much complexity in
a handler's design to end up with subtle inconsistencies. Rather, as soon
as you stop auto-forwarding anything you have to put a great amount of care
into ensuring they do remain internally consistent. A higher level hook
that exposes the ability to tweak the thing you want to tweak, while
ensuring it all remains consistent automatically, is more desirable.


On Wed, Jan 9, 2013 at 5:18 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> On Jan 9, 2013, at 1:56 PM, David Bruant wrote:
>
> Le 09/01/2013 20:30, Allen Wirfs-Brock a écrit :
>
> ...
>
>
> I don't see any need for an intermediate proxy representation or for
> attempting to limit non-proxy based extension mechanisms.  However, if
> Proxy is not sufficiently powerful to support everything that needs to be
> done in the real world (and in particular by browsers) then we probably
> should be looking at how to fill those deficiencies.
>
> Agreed.
>
>
> I guess I should have also said, that Proxy should be viewed as the last
> resort solution and should seldom be needed. Method dispatch based
> extension hooks like the @@create, @@hasInstance, and @@ToPrimitive hooks
> in the current ES6 draft and the hooks described in the "Object Model
> Reformation" [ 1] strawman operate at a higher meta level and are probably
> generally preferable to proxy based solutions.  It is impossible for them
> to violate the object invariants. If we still have self-hosting
> deficiencies we probably should first look for that style of solution
> before extending Proxy.
>
> Allen
>
> [1]
> http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130109/0f7104ac/attachment.html>


More information about the es-discuss mailing list