[Q] Why Squeak don't have a Singleton class ?

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Fri Dec 2 10:37:30 UTC 2005


Trying to learn, I don't found a Singleton class in Squeak ( maybe exist
whit another name ? )

So following
http://www.eli.sdsu.edu/courses/spring01/cs635/notes/singleton/singleton.htm
l
We could have:

Object subclass: #Singleton
   instanceVariableNames: ''
   classVariableNames: 'UniqueInstance '
   poolDictionaries: ''
   category: 'Kernel-Classes'
   
current
   UniqueInstance ifNil: [UniqueInstance := Singleton basicNew].
   ^UniqueInstance
   
new
   self error: 'Use current to get an instance of Class ' , self name

Wish to know:

1) If exist this with another name
2) In case not, why not
3) How could hurt me (us) if we have this

Thanks in advance.

Edgar



	

	
		
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




More information about the Squeak-dev mailing list