SRFI 124: Ephemerons

by John Cowan

status: final (2015-11-06)

keywords: Data Structure, R7RS Large, R7RS Large: Red Edition


An ephemeron is an object with two components called its key and its datum. It differs from an ordinary pair as follows: if the garbage collector (GC) can prove that there are no references to the key except from the ephemeron itself and possibly from the datum, then it is free to break the ephemeron, dropping its reference to both key and datum. In other words, an ephemeron can be broken when nobody else cares about its key. Ephemerons can be used to construct weak vectors or lists and (possibly in combination with finalizers) weak hash tables.

Much of this specification is derived with thanks from the MIT Scheme Reference Manual.