es7 proposal/polyfill?: base Map/WeakMap off Proxy + Weak References

Coroutines coroutines at
Fri Feb 19 09:17:10 UTC 2016

Hi - I hope I am not suggesting something that has been said before ~

Having Proxy and eventual Weak References makes it possible to build
Map/WeakMap in plain JS - nothing in hidden, 'native code' (C++).

I'd like to propose basing them off of these when Weak References are a 'thing'.

Map's API could just go away and follow traditional Object assignment
and existence checks:

map[key] = value;

// wish JS had a null-coalescing `?` operator like Coffeescript..
if (map[key] !== undefined || map[key] !== null) { ... }

It's totally legal in non-Node JS to have Objects as keys in other
Objects, right? (I forget)

So that's my idea.  Toodles ~

PS: And build Set off of a Proxy + Array.  Just stop being weird. :P

More information about the es-discuss mailing list