| | | Types, Classes and Properties |
Types, Classes and Properties
GOO types categorize objects. Types are first class. They are used
to annotate bindings. Binding types restrict the type of objects
bindable to associated bindings.
GOO supports the following types in order of specificity
(with the exact ordering defined in Appendix *):
- Singleton types specify a unique instance,
- Classes and properties specify the structure,
inheritance, and
initialization of objects. Every object is a direct instance of a
particular class,
- Product types specify a cross product of types,
- Subclass types specify a lineage of classes, and
- Union types specify a union of types.
The basic type protocol is:
<type> | (<any>) | C |
isa? | (x|<any> y|<type> => <log>) | G |
subtype? | (x|<type> y|<type> => <log>) | G |
| returns true iff x is a subtype of y. | |
new | (type|<type> prop-inits|...) | G |
| creation protocol taking type and creation options where
prop-inits contains getter / initial value pairs. | |
|
| | | Types, Classes and Properties |