Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
Singleton classes
Factor documentation
>
Factor handbook
>
The language
>
Objects
>
Classes
Prev:
Predicate classes
Next:
Class operations
A singleton is a class with only one instance and with no state.
SINGLETON:
SINGLETONS:
define-singleton-class
( word -- )
The set of all singleton classes is itself a class:
singleton-class?
( object -- ? )
singleton-class