improve docs on make-weak-hash

Note that values are held normally and ephemerons can help.
This commit is contained in:
Matthew Flatt 2015-10-22 09:40:37 -06:00
parent b98731ed00
commit 2e3ff0332d

View File

@ -170,7 +170,14 @@ See also @racket[make-custom-hash].}
Like @racket[make-hash], @racket[make-hasheq], and
@racket[make-hasheqv], but creates a mutable hash table that holds
keys weakly.}
keys weakly.
Beware that values in the table are retained normally. If a value in
the table refers back to its key, then the table will retain the value
and therefore the key; the mapping will never be removed from the
table even if the key becomes otherwise inaccessible. To avoid that
problem, instead of mapping the key to the value, map the key to an
@tech{ephemeron} that pairs the key and value.}
@deftogether[(
@defproc[(make-immutable-hash [assocs (listof pair?) null])