|
Singleton ::= Object clone tap {
|
|
self id := 0.
|
|
self newID := {
|
|
self id := self id + 1.
|
|
}.
|
|
self clone := {
|
|
err ArgError clone tap { self message := "Singleton object!". } throw.
|
|
}.
|
|
}.
|
|
|
|
println: Singleton newID. ; 1
|
|
println: Singleton newID. ; 2
|
|
println: Singleton newID. ; 3
|