Use cases for WeakMap

Allen Wirfs-Brock allen at wirfs-brock.com
Sun May 15 15:31:02 PDT 2011


On May 14, 2011, at 5:03 PM, Oliver Hunt wrote:

> I suspect i did suggest WeakMap but I think I misunderstood the proposal.  I felt the goal was to prevent the key from being kept around forever even when the value was gone, I did not expect the key to keep the value alive.
> 
> --Oliver
> 

I think I've suggest in the past that what we are currently calling "WeakMap" should just be called "ObjectMap" or something like that.  I can't think of any use case where object identify is used as a map key and you don't want the "WeakMap" semantics.  Essentially "WeakMap" just means "NonLeakyObjectMap".

Allen



More information about the es-discuss mailing list