Previous: Record Classes, Up: Classes


1.4 Specializers

A specializer is a generalization of a class. A specializer is any one of the following:

A specializer may be used in many contexts where a class is required, specifically, as a method specializer (hence the name), as the second argument to subclass?, and elsewhere.

— Procedure: specializer? object

Returns #t if object is a specializer, otherwise returns #f.

— Procedure: specializer-classes specializer

Returns a list of the classes in specializer. If specializer is a class, the result is a list of that class. If specializer is a record type, the result is a list of the record type's class. If specializer is a union specializer, the result is a list of the component classes of the specializer.

— Procedure: specializer=? specializer1 specializer2

Returns #t if specializer1 and specializer2 are equivalent, otherwise returns #f. Two specializers are equivalent if the lists returned by specializer-classes contain the same elements.

— Procedure: union-specializer specializer ...

Returns a union specializer consisting of the union of the classes of the arguments. This is equivalent to converting all of the specializer arguments to sets of classes, then taking the union of those sets.

— Procedure: union-specializer? object

Returns #t if object is a union specializer, otherwise returns #f.

— Procedure: specializers? object

Returns #t if object is a list of specializers, otherwise returns #f.

— Procedure: specializers=? specializers1 specializers2

Specializers1 and specializers2 must be lists of specializers. Returns #t if specializers1 and specializers2 are equivalent, otherwise returns #f. Two specializers lists are equivalent if each of their corresponding elements is equivalent.