WeakMap API questions?

David Herman dherman at mozilla.com
Fri Sep 3 08:22:31 PDT 2010

But HashMaps and WeakMaps both map objects to values. The difference is just that, with WeakMaps, the mapping is weak. The name is excellent, short, and clear.

> Perhaps ObjectMap would be better?

That wouldn't distinguish them from HashMaps, since they are both object maps.

WeakMap is a really, really good name. Nay, an /incredibly awesome/ name. Good names are so hard to come by. Let's not overthink this in the effort to prevent all possible confusion. Mike momentarily forgot what they mean, but there aren't really any API docs as such and it's not like he was actually writing code with them. I'd imagine after spending 30 seconds writing code with WeakMaps, no one would confuse about the types.

It ain't broke -- don't fix it!


More information about the es-discuss mailing list