[Harmony proxies] Proxies, prototype chain and inheritance

Tom Van Cutsem tomvc.be at gmail.com
Tue Mar 22 04:58:26 PDT 2011


>
> Another way of solving the inconsistency I see in providing the 6
> "prototype-climbing" traps ("getPropertyDescriptor", "getPropertyNames",
> "has", "get", "set" and "enumerate") and protecting Object.getPrototypeOf
> and instanceof could be to provide a softer version of proxies where these
> traps wouldn't be provided. Prototype-climbing internal methods would be
> delegated to the ECMAScript engine with the default behavior they have on
> objects (but still calling own traps when their algorithm requires them to).
> By design of this softer version, proxy writers would be ensured that
> inheritance will be done properly for them and they don't have to worry
> about it. They would just have to take care of the own properties "layer".
> (This paragraph is a slightly different topic. If you feel it requires its
> own thread, feel free to fork)
>

I think this "softer version" already exists. If we can get agreement to
turn getPropertyDescriptor and getPropertyNames into derived traps (see <
http://wiki.ecmascript.org/doku.php?id=strawman:proxy_derived_traps>), then
all of the prototype-climbing traps become derived. As such, proxy writers
that stick to overriding only fundamental traps will only need to take care
of the "own layer", and inheritance will be taken care of by the default
implementation of the derived traps.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110322/31a823a2/attachment.html>


More information about the es-discuss mailing list