RosettaCodeData/Task/Singleton/Latitude/singleton.latitude
2023-07-01 13:44:08 -04:00

13 lines
292 B
Text

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