Free-able objects categories
Objects, Classes and Slots
parametric class
Calls and Slot Access

parametric class

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.0im:float = 0.0)
CLAIRE includes a type system that contains parametric class selections. For instance, the set of real numbers can be defined as a subset of complex with the additional constraint that the imaginary part is 0.0. This is expressed in CLAIRE as follows :
 complex[re:floatim:{0.0}]
In the previous example with stacks, parametric sub-types can be used to designate typed stacks. We can either specify the precise range of the stack (i.e., the value of the of parameter) or say that the range must be a sub-type of another type. For instance, the set of stacks with range integer and the set of stacks which contain integers are respectively :
 stack[of:{integer}]
 stack[of:subtype[integer]]