WeakMap API questions?
erik.corry at gmail.com
Fri Sep 3 05:19:05 PDT 2010
2010/9/2 Mike Shaver <mike.shaver at gmail.com>:
> On Thu, Sep 2, 2010 at 11:32 AM, Erik Corry <erik.corry at gmail.com> wrote:
>> Surely that is the case with WeakMap? At least unless you lost the
>> key and don't have any other references to the value. In which case
>> you can't reach the value any more, so why would you care whether it
>> is kept alive?
> You're right; I forgot about the fact that the keys were not
> necessarily value types. Sorry for the noise.
I wonder if this points to potential confusion stemming from the
WeakMap name. It seems obvious (and wrong) that a WeakMap would act a
little like a HashMap where the values were WeakReferences.
Perhaps ObjectMap would be better?
More information about the es-discuss