16.1 Weak Boxes (original) (raw)

16.1 Weak Boxes🔗

A weak box is similar to a normal box (seeBoxes), but when the garbage collector (seeGarbage Collection) can prove that the content value of a weak box is only reachable via weak references, the content of the weak box is replaced with #f. A weak reference is a reference through a weak box, through a key reference in a weak hash table (see Hash Tables), through a value in an ephemeronwhere the value can be replaced by #f (seeEphemerons), or through a custodian (seeCustodians).

Returns a new weak box that initially contains v.

Returns the value contained in weak-box. If the garbage collector has proven that the previous content value ofweak-box was reachable only through a weak reference, thengced-v (which defaults to #f) is returned.

Returns #t if v is a weak box, #f otherwise.