WeakMaps question ?

Russell Leggett russell.leggett at gmail.com
Sat Nov 12 05:10:12 PST 2011

On Nov 11, 2011, at 6:55 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> On Nov 11, 2011, at 3:39 PM, Oliver Hunt wrote:
>> A weak map can only remove an entry if both the key and value have died, in many ES implementations a number of the primitives are not gc allocated and so can never die, or are cached globally so have lifetime unrelated to any given program.
> Yes, but this isn't just an implementation decision. The primitive values have existential identify (my term,  philosophers may mean something else).  All such values conceptually exist for all time, regardless of whether or not an instance of a particular value is actually instantiated an any particular point in time. 

Regardless of the implementation of primitive values, couldn't we say that the semantics of a weak map ignore primitive keys and look only at the value. Primitive keys are exceptionally common for maps, and this would open up a lot of potential uses, especially regarding caching.

> Allen
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list