Package: trivial-garbage

Function make-weak-hash-table

Lambda List

make-weak-hash-table (&rest args &key weakness weakness-matters &allow-other-keys)


Returns a new weak hash table. In addition to the standard arguments accepted by cl:make-hash-table, this function adds extra keywords: :weakness being the kind of weak table it should create, and :weakness-matters being whether an error should be signalled when that weakness isn't available (the default is to signal an error). weakness can be one of :key, :value, :key-or-value, :key-and-value.

If weakness is :key or :value, an entry is kept as long as its key or value is reachable, respectively. If weakness is :key-or-value or :key-and-value, an entry is kept if either or both of its key and value are reachable, respectively.

tg::make-hash-table is available as an alias for this function should you wish to import it into your package and shadow cl:make-hash-table.