TXR Lisp uses weak hash tables for mapping code to file/line information.
Hash tables support four flavors of weakness: weak key, weak value, weak key AND value, weak key OR value.
For source code location info tables, we want the keys to be weak (if the code becomes garbage, we want the table to drop the source location info). However, that table will usually hold the only reference to the source location info, and so values must be "strong".
Hash tables support four flavors of weakness: weak key, weak value, weak key AND value, weak key OR value.
For source code location info tables, we want the keys to be weak (if the code becomes garbage, we want the table to drop the source location info). However, that table will usually hold the only reference to the source location info, and so values must be "strong".