From 2e3ff0332d99a926ea05321d1aa76cef44508078 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Oct 2015 09:40:37 -0600 Subject: [PATCH] improve docs on `make-weak-hash` Note that values are held normally and ephemerons can help. --- pkgs/racket-doc/scribblings/reference/hashes.scrbl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-doc/scribblings/reference/hashes.scrbl b/pkgs/racket-doc/scribblings/reference/hashes.scrbl index b5b3421634..227199413c 100644 --- a/pkgs/racket-doc/scribblings/reference/hashes.scrbl +++ b/pkgs/racket-doc/scribblings/reference/hashes.scrbl @@ -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])