]> gitweb.factorcode.org Git - factor.git/blob - core/classes/mixin/mixin-docs.factor
Fix permission bits
[factor.git] / core / classes / mixin / mixin-docs.factor
1 USING: help.markup help.syntax help words compiler.units
2 classes sequences ;
3 IN: classes.mixin
4
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."
7 { $subsection POSTPONE: MIXIN: }
8 { $subsection POSTPONE: INSTANCE: }
9 { $subsection define-mixin-class }
10 { $subsection add-mixin-instance }
11 "The set of mixin classes is a class:"
12 { $subsection mixin-class }
13 { $subsection mixin-class? }
14 "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."
15 { $see-also "unions" "tuple-subclassing" } ;
16
17 HELP: mixin-class
18 { $class-description "The class of mixin classes." } ;
19
20 HELP: define-mixin-class
21 { $values { "class" word } }
22 { $description "Defines a mixin class. This is the run time equivalent of " { $link POSTPONE: MIXIN: } "." }
23 { $notes "This word must be called from inside " { $link with-compilation-unit } "." }
24 { $side-effects "class" } ;
25
26 HELP: add-mixin-instance
27 { $values { "class" class } { "mixin" class } }
28 { $description "Defines a class to be an instance of a mixin class. This is the run time equivalent of " { $link POSTPONE: INSTANCE: } "." }
29 { $notes "This word must be called from inside " { $link with-compilation-unit } "." }
30 { $side-effects "class" } ;
31
32 { mixin-class define-mixin-class add-mixin-instance POSTPONE: MIXIN: POSTPONE: INSTANCE: } related-words
33
34 ABOUT: "mixins"