RosettaCodeData/Task/Singleton/Phix/singleton-1.phix

20 lines
363 B
Plaintext

-- <separate include file>
object chk = NULL
class singleton
public procedure check()
if chk==NULL then
chk = this
elsif this!=chk then
?9/0
end if
?"ok"
end procedure
end class
global singleton s = new()
--global singleton s2 = new()
-- </separate include file>
s.check()
--s2.check() -- dies