VocabularysyntaxSyntaxTUPLE: class slots... ;
TUPLE: class < superclass slots ... ;
Inputs and outputs| class | a new tuple class to define |
| slots | a list of slot specifiers |
Word descriptionDefines a new tuple class.
The superclass is optional; if left unspecified, it defaults to
tuple.
Slot specifiers take one of the following three forms:
| • | name - a slot which can hold any object, with no attributes |
| • | { name attributes... } - a slot which can hold any object, with optional attributes |
| • | { name class attributes... } - a slot specialized to a specific class, with optional attributes |
Slot attributes are lists of slot attribute specifiers followed by values; a slot attribute specifier is one of
initial: or
read-only. See
Tuple slot declarations for details.
ExamplesA simple tuple class:
TUPLE: color red green blue ;
Declaring slots to be integer-valued:
TUPLE: color
{ red integer }
{ green integer }
{ blue integer } ;
An example mixing short and long slot specifiers:
TUPLE: person
{ age integer initial: 0 }
{ department string initial: "Marketing" }
manager ;
See alsotuple-class,
define-tuple-classDefinition