[Q][BUG] 5905 double initialize ?

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Mon May 3 09:55:39 UTC 2004


On 02/05/04 12:03, "Ned Konz" <ned at bike-nomad.com> wrote:

> On Sunday 02 May 2004 4:58 am, Lic. Edgar J. De Cleene wrote:
>> I have this weirdness and wish know someone have it
>> 
>> Class method:
>> start
>>     super new initialize "This execute twice  instance initialize method"
>> 
>> If I change to
>> 
>> start
>>     super new start "This execute only once"
>> 
>> Can someone check this or explain ? Never see this before 5905.
> 
> Quite a while ago 'new' was made to call initialize.
> 
> So if you have callers in your image that call 'super new initialize' they may
> be initializing twice.
"Change Set:        KCP-103-GeneralizeTheUseOfTheNewInitializePattern
Date:            16 September 2003
Author:            Noury Bouraqadi

This is in 5503

When following code:

TEGClient class(Behavior)>>new "This was
    Receiver: TEGClient
    Arguments and temporary variables:

    Receiver's instance variables:
        superclass:     Object
        methodDict:     a MethodDictionary(#initialize->a CompiledMethod
(2790) #newSocket->a CompiledMethod (3186) #socke...etc...
        format:     136
        instanceVariables:     #('socket' 'serverName' 'instanciaTEG')
        organization:     ('as yet unclassified' initialize newSocket
socket)

        subclasses:     nil
        name:     #TEGClient
        classPool:     nil
        sharedPools:     nil
        environment:     a SystemDictionary(lots of globals)
        category:     nil

TEGClient class>>start
    Receiver: TEGClient
    Arguments and temporary variables:

new
    "Answer a new initialized instance of the receiver (which is a class)
    with no indexable variables. Fail if the class is indexable."
    ^ self basicNew initialize

So is a good thing do not to have extra code
If I do TEGClient new (and have initialize code correct) , only have one
initialization.

Good work KCP guys and thanks Ned.

Edgar




More information about the Squeak-dev mailing list