Intersection classes - Factor Documentation (original) (raw)

An object is an instance of an intersection class if it is an instance of all of its participants.
INTERSECTION:

define-intersection-class ( class participants -- )

Intersection classes can be introspected:

class-participants ( class -- seq )

The set of intersection classes is a class:

intersection-class

intersection-class? ( object -- ? )

Intersection classes are used to associate a method with objects which are simultaneously instances of multiple different classes, as well as to conveniently define predicates.