improve docs on make-weak-hash
Note that values are held normally and ephemerons can help.
This commit is contained in:
parent
b98731ed00
commit
2e3ff0332d
|
@ -170,7 +170,14 @@ See also @racket[make-custom-hash].}
|
||||||
|
|
||||||
Like @racket[make-hash], @racket[make-hasheq], and
|
Like @racket[make-hash], @racket[make-hasheq], and
|
||||||
@racket[make-hasheqv], but creates a mutable hash table that holds
|
@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[(
|
@deftogether[(
|
||||||
@defproc[(make-immutable-hash [assocs (listof pair?) null])
|
@defproc[(make-immutable-hash [assocs (listof pair?) null])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user