WeakMap better than Private Symbols? (was: direct_proxies "problem")

Irakli Gozalishvili rfobic at gmail.com
Sun Jan 13 20:20:02 PST 2013

Here is a link to a documentatin for the weak map based solution that Kris


We find it invaluable and use for storing private field. Inheritance works,
but we did not found that feature all that useful in practice, probably
because we use that only for data fields

There is also another experiment that I found to be a lot more useful for
non data properties like methods

I also honestly wish private names would just be it

On Thursday, January 10, 2013, Kris Kowal wrote:

> As an aside, Irakli Gozashvili and I independently realized that you
> could use a WeakMap for parallel objects with inheritance. Very
> similar to Brendan’s createStorage, we put together a parallel
> universe constructor.
> function Parallel(root) {
>     var parallel = new WeakMap();
>     root = root || null;
>     function get(object) {
>         if (!parallel.has(object)) {
>             parallel.set(object,
> Object.create(get(Object.getPrototypeOf(object))));
>         }
>         return parallel.get(object);
>     }
>     return get;
> }
> Irakli’s was a Namespace constructor that appeared somewhere in the
> Mozilla Add-on toolkit, but the links have gone stale.
> Kris Kowal
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <javascript:;>
> https://mail.mozilla.org/listinfo/es-discuss

Typed on tiny virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130113/03e6adc6/attachment.html>

More information about the es-discuss mailing list