What you are asking for is sometimes called a "WeakValueMap". It is a very
sensible abstraction and sometimes exactly what is needed. It is easy to
build using Maps (or WeakMaps, depending) combined with <
https://github.com/tc39/proposal-weakrefs>.

The old wiki.ecmascript.org shows an implementation of a WeakValueMap in
terms of these. Unfortunately the wiki still seems to be offline.

Since there are still outstanding links into it, how did the wiki get
collected? Were these links weak? ;)






On Tue, Mar 21, 2017 at 7:20 AM, Boris Zbarsky <bzbar...@mit.edu> wrote:

> On 3/21/17 2:15 AM, /#!/JoePea wrote:
>
>> I'd like to have something like a WeakMap where the keys can be
>> primitives and the values are weakly-held Objects
>>
>
> It might be worth searching the archives: this has been proposed multiple
> times and discussed at quite some length.
>
> If there isn't an existing document that summarizes the discussions (and
> quick searching doesn't find one in the top several hits, though it does
> find https://esdiscuss.org/topic/what-is-the-status-of-weak-references at
> the very least), there really should be one...
>
> -Boris
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to