Thank you for sharing your experience with it. So, when I see all this, I
think depending on initialize method on class side seems like a pretty bad
idea. So I decided to leave this way of thoughts and I came up with lazy
initialization. With lazy initialization it seems to work just fine and my
problem is probably solved.

mcz if you want:
http://www.mediafire.com/download/c4jwmkz58mb4e9t/Something-bliznjan.7.mcz

Thank you all for your help.

Jan


Ben Coman wrote
> Each class needs its *own* initialize method.  You can observe this
> behaviour as follows...
> 
> 1. Create a new package MyPlay holding the following...
> 
>     Object subclass: #SomeClass
> 
>     SomeClass class>>#initialize
>             self inform: 'Initializing... ' , self name.
> 
>     #SomeClass object: #SubClass "Notice that there was no inform message"
> 
> 2. Export package to local disk using Monticello.
> 
> 3. Delete MyPlay package.
> 
> 4. Via Monticello load MyPlay package.
>      Observe that you only get an inform message for SomeClass, and not
> SubClass.
> 
> 
> I wanted to understand this behaviour more, so I modified...
> 
>     SomeClass class>>#initialize
>             self haltOnce.
>             self inform: 'Initializing... ' , self name.
> 
> ...then enabled haltOnce and repeated steps 2, 3, 4 -- which broke out
> from
> MCMethodDefinition>>postloadOver:
> which shows #initialize is only called on classes where #initialize is
> defined.
> 
> 
> So it seems that creating a new class does not call #initialize at all,
> let
> alone an inherited one.  It is a Monticello behaviour.
> 
> cheers -ben





--
View this message in context: 
http://forum.world.st/class-initialization-and-class-side-variables-tp4822869p4822920.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to