Am 14.01.2013 um 07:54 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
Morning, Norbert,
On 14 Jan 2013, at 07:44, Norbert Hartl <norbert@hartl.name> wrote:
As for every other objects initialize is called when the object is created. Upgrading code might change the shape of the object but then there is no initialize call. Do you want to have initialize called every tiny code change? Using *cello you can use postLoadDoits to tweak stuff.
You mean that, in your opinion, making sure that the #initialize is called in every scenario (new/existing class) can only be done with an explicit action ?
I think that the primary purpose is to initialize newly created space. In case of shape change this doesn't happen. So taking the example you initialize e.g. an instvar with a collection. Do you want to reinitialize it even if you corrected a typo in the comment of a method? If I wanted to have control over those things I would on class initialization register a class of mine to the local change notification system in the image. But this isn't easy to do in a cross platform manner. Maybe there are better ways. I'm sure someone will speak up then. Norbert
Sven
Norbert
Am 14.01.2013 um 07:20 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
Hi,
For a long time I have been having troubles with #initialize (not) being sent to classes that just got loaded.
Apparently #initialize is only sent to *newly* loaded classes that did not exist before ?
It does not get sent to existing classes being reloaded/overwritten ?
Does the fact that the #initialize class method itself gets overwritten (actually changes) have anything to do with it ?
What would be the best practice here ? The most portable one ?
I want to be able to make sure #initialize is sent when I want it.
Thx,
Sven
PS: I am looking for a solution that would work for Monticello package loading, via Gofer or Metacello as well as regular #fileIn.
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill