| Free-able objects | categories Objects, Classes and Slots parametric class |
Calls and Slot Access |
A class can be parameterized by a subset of its slots. This means that subsets of the class that are defined by the value of their parameters can be used as types. This feature is useful to describe parallel structures that only differ by a few points: parametrization helps describing the common kernel, provides a unified treatment and avoids redundancy.
A parameterized class is defined by giving the list of slot names into brackets. Parameters can be inherited slots, and include necessarily inherited parameters.
| stack[of] <: object(of:type, content:list[any], index:integer = 0) complex[re,im] <: object(re:float = 0.0, im:float = 0.0) |
| complex[re:float, im:{0.0}] |
| stack[of:{integer}] stack[of:subtype[integer]] |