Class Initialization

Frank Caggiano frank at crystal-objects.com
Tue Mar 9 20:46:26 UTC 2004


It's been a long time since I worked with any other Smalltalk other than 
Squeak and the following class initialization situation has me confused.

If a class has a class method 'initialize' when that class is loaded 
into the system either as a filed in cs, or .st file or if it is loaded 
via monticello the initialize method is run.

Question: Is this normal smalltalk behavior or is squeak specific? The 
literature is fuzzy on class initialization.

Now lets say you have two classes A and B with B being a subclass of A.
A has a class initialize method, B also has a class initialize method 
and being a subclass of A it was thought that a super initialize was 
needed in B to get A to initialize.  What happens in this case is that 
A's initialize gets run twice.

Question: How should this situation be handled? Should B just assume 
that if A is in the system (and it must be if B is A's subclass and B is 
loaded, correct) that A is initialized and not worry about it?

Of course all this came about after 1 1/2 days of tracking down what I 
thought was a bug but was the above situation so I might be totally 
wrong about the whole mess.

regards
-- 
Frank Caggiano				"The best education for the best
caggiano at crystal-objects.com		is the best education for all."
http://www.crystal-objects.com/		   Robert M. Hutchins

Logo Users Ring
http://www.crystal-objects.com/logo/logoring.html







More information about the Squeak-dev mailing list