racket/racket
Matthew Flatt 2b79ba6d4f add ephemeron hash tables
Weak hash tables retain keys weakly, but they hold each corresponding
value strongly as long as the key is accessible. As a result, weak
hash tables suffer from the key-in-value problem: if the value refers
to the key, the key cannot become inaccesible and be removed from the
table.

Previously, the way around that problem was to map a key to an
ephemeron that combines the key and value. The extra cost of involving
ephemerons (a constant factor) is why ephemerons storage is not the
default behavior of weak hash tables.[*] Having ephemeron hash tables
as a distinct variant avoids imposing a cost where its not needed, and
compared to using explicit ephemerons, it's easier to drop into a
program that was written to use strong or merely weak hash tables.

For Racket CS, the change is especially straightforward, because
ephemeron tables already exist in Chez Scheme (at least for the Racket
variant, in the case of eqv- and equal-based tables).

[*] Also, non-emphemeron hash tables turn out to be needed for certain
    finalization tasks.
2021-02-27 19:08:05 -07:00
..
collects add ephemeron hash tables 2021-02-27 19:08:05 -07:00
src add ephemeron hash tables 2021-02-27 19:08:05 -07:00
.gitignore internal hooks to build "Racket.exe" without "libracket3m.dll" 2015-03-28 09:50:01 -06:00