#initialize and MC

Alejandro F. Reimondo aleReimondo at smalltalking.net
Sat Sep 16 18:51:53 UTC 2006


Damien,
Please revise why you need to initialize the class...
It is common the use of instance class variables or globals
 and if this is the case, it is recommended to use accessors
 and deferred initialization.
It is not correct to assume that #initialize will be sent and
 it will success (in case of error, your class will be partially
 "initialized").
If you write deferred initialization, ensure that the setting is
 commited at end of the metod, to give a new chance to
 sucess if an error is triggered when constructing the
 initial object.
cheers,
Ale.


----- Original Message ----- 
From: "Damien Cassou" <damien.cassou at laposte.net>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Saturday, September 16, 2006 3:15 PM
Subject: Re: #initialize and MC


> It seems #initialize (on the class side) is called by Monticello only if
> implemented in the class directly. Am I right ?
>
> I want the same initialization code to be launched for a class and all
> its subclasses. It is possible to do this without copy-pasting ? Maybe
> with Traits. Nothing simple ?
>
> It's very strange that #initialize is only called for the implementing
> class, I don't understand why.
>
> Bye
>
> -- 
> Damien Cassou
>
>




More information about the Squeak-dev mailing list