1 USING: help.markup help.syntax help words compiler.units
5 ARTICLE: "mixins" "Mixin classes"
6 "An object is an instance of a union class if it is an instance of one of its members. In this respect, mixin classes are identical to union classes. However, mixin classes have the additional property that they are " { $emphasis "open" } "; new classes can be added to the mixin after the original definition of the mixin."
13 "The set of mixin classes is a class:"
18 "Mixins are used to defines suites of behavior which are generally useful and can be applied to user-defined classes. For example, the " { $link immutable-sequence } " mixin can be used with user-defined sequences to make them immutable."
19 { $see-also "unions" "maybes" "tuple-subclassing" } ;
22 { $class-description "The class of mixin classes." } ;
24 HELP: define-mixin-class
25 { $values { "class" word } }
26 { $description "Defines a mixin class. This is the run time equivalent of " { $link POSTPONE: MIXIN: } "." }
27 { $notes "This word must be called from inside " { $link with-compilation-unit } "." }
28 { $side-effects "class" } ;
30 HELP: add-mixin-instance
31 { $values { "class" class } { "mixin" class } }
32 { $description "Defines a class to be an instance of a mixin class. This is the run time equivalent of " { $link POSTPONE: INSTANCE: } "." }
33 { $notes "This word must be called from inside " { $link with-compilation-unit } "." }
34 { $side-effects "class" } ;
36 { mixin-class define-mixin-class add-mixin-instance POSTPONE: MIXIN: POSTPONE: INSTANCE: } related-words