Union classes
Factor handbook » The language » Objects » Classes

Prev:Built-in classes
Next:Intersection classes


An object is an instance of a union class if it is an instance of one of its members.
UNION:

define-union-class ( class members -- )


Union classes can be introspected:
class-members ( class -- seq )


The set of union classes is a class:
union-class

union-class? ( object -- ? )


Unions are used to define behavior shared between a fixed set of classes, as well as to conveniently define predicates.

See also
Mixin classes, Maybe classes, Tuple subclassing