Next: Type annotations, Previous: Hash tables, Up: System features
Scheme48 provides an interface to weakly held references in basic weak
pointers and populations, or sets whose elements are weakly held.
The facility is in the structure weak.
#f
Make-weak-pointercreates a weak pointer that points to contents.Weak-pointer?is the weak pointer disjoint type predicate.Weak-pointer-refaccesses the value contained withinweak-pointer, or returns#fif there were no strong references to the contents and a garbage collection occurred. Weak pointers resemble cells, except that they are immutable and hold their contents weakly, not strongly.
Make-populationconstructs an empty population.Add-to-population!adds object to the population population.Population->listreturns a list of the elements of population. Note, though, that this can be dangerous in that it can create strong references to the population's contents and potentially leak space because of this.Walk-populationapplies proc to every element in population.