Dimitris,

Relying in class side initialize is not very cool. Mostly, because it's
hard to know EXACTLY when Monticello will send it. For sure it's the first
time you load that class. But then it could be if such method changes
again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class side
initialize.  So...another approaches you can take (depending on your needs)
is lazy class var getters with ifNil:   or  if you have a
ConfigurationOfYourApp, you can define #postLoadDoIts in which you can
perform the whole initialization of your app. Or ...from the #postLoadDoIts
simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis <kilon.al...@gmail.com>
wrote:

> ok that means  I cannot rely on it and I will have to initialize my class
> variables in specific methods. No problem, ifNil here I come :)
>
> On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <s...@stfx.eu>
> wrote:
>
>> Hi Dimitris,
>>
>> > On 07 Dec 2015, at 23:12, Dimitris Chloupis <kilon.al...@gmail.com>
>> wrote:
>> >
>> > I have read that a metaclass (class side of the class) is initialised
>> when its loaded to the image by monticello, Are there any other cases when
>> the initialize method of the the metaclass is being called ?
>>
>> Correct: a class #initialize is called when its code is loaded, but only
>> if it is not yet present or different in source code from what is already
>> present (this last point will bite you one day ;-).
>>
>> Else, the #initialize should be called manually (for example to reload
>> some caches, or reset some system state). This sometimes happens in
>> #postLoads or install scripts.
>>
>> I am not aware of any automatic invocations.
>>
>> Sven
>>
>>
>>
>>
>>


-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to