5 Types and Classes
A singleton for an object is created by passing the object to the function singleton, or by calling the function
make on the class
Singleton methods are considered more specific than methods defined on an object's class. Singletons are the most specific specializer.
define method double (thing :: singleton(#"cup")) #"pint" end method double (#"cup")Dylan provides a concise syntax for singletons used as method specializers. The folowing definition is equivalent to the one above; it generates a call to the binding of
singletonin the current lexical environment.
define method double (thing == #"cup") #"pint" end method double (#"cup")
Generated with Harlequin WebMaker