Function.create
Tom Van Cutsem
tomvc.be at gmail.com
Wed Sep 28 00:19:38 PDT 2011
2011/9/27 David Bruant <david.bruant at labri.fr>
> I just wanted to give a follow-up on that. I implemented it:
>
> https://github.com/DavidBruant/HarmonyProxyLab/tree/master/MutableProtoObjects
Nice experiment.
Also, I implemented another flavor of Forwarder (similar to [1]) which
> explicitly calls Object.getPrototypeOf when needed (which allows me to
> return a different value when needed). I have no opinion on whether it's
> better or worse, but i just wanted to point it out.
>
Right, I've also been thinking about this. There are two possible forwarding
handlers:
1) one that uses the "virtual" prototype passed to Proxy.create
2) one that uses Object.getPrototypeOf(target)
Option #2 is what's in the proposal [1]. I think that's a safe bet, since
most proxies will not want to interfere with the prototype chain and will
probably even set the virtual prototype equal to the target's prototype, in
which case #1 and #2 are the same. We could make the choice between #1 and
#2 configurable, but I don't think it's worth the additional complexity.
Cheers,
Tom
> David
>
> [1] http://wiki.ecmascript.org/doku.php?id=harmony:proxy_defaulthandler
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110928/579aaa21/attachment-0001.html>
More information about the es-discuss
mailing list