VocabularysyntaxSyntaxSINGLETON: class
Inputs and outputs| class | a new singleton to define |
Word descriptionDefines a new singleton class. The class word itself is the sole instance of the singleton class.
ExamplesUSING: classes.singleton kernel io ;
IN: singleton-demo
USE: prettyprint SINGLETON: foo
GENERIC: bar ( obj -- )
M: foo bar drop "a foo!" print ;
foo bar
a foo!
See alsodefine-singleton-classDefinition