Handbook
Glossary
Intersection classes
Factor handbook
»
The language
»
Objects
»
Classes
Prev:
Union classes
Next:
Maybe classes
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.