A WeakMap where values (not keys) are weak references?

Mark S. Miller erights at google.com
Tue Mar 21 16:04:48 UTC 2017


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 <bzbarsky at 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 at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170321/7fbd093c/attachment.html>


More information about the es-discuss mailing list