On 25 Feb 2016, at 13:34, Cl��ment Bera <bera.clement@gmail.com> wrote:

Hi,

when redefining new you don't have to use super:

BlElement class>>new
    ^ self basicNew 
        basicSpace: BlUniverse default runningSpace;
        initialize;
        yourself

IMO that's a better practice that redefining basicNew.

I just sent the same example ;)


Usually basicNew is only redefined when you cannot instantiate the objects using the normal API because it is not supported by the runtime (SmallInteger, Context, etc.)



2016-02-25 12:33 GMT+01:00 Alain Plantec via Pharo-dev <pharo-dev@lists.pharo.org>:


---------- Message transf��r�� ----------
From: Alain Plantec <alain.plantec@yahoo.com>
To: Pharo Development List <pharo-dev@lists.pharo.org>
Cc: 
Date: Thu, 25 Feb 2016 12:37:59 +0100
Subject: Re: [Pharo-dev] [bloc] why redefining new is not enough?

> On 25 f��vr. 2016, at 11:49, Esteban Lorenzano <estebanlm@gmail.com> wrote:
>
> this is bad��� redefining basicNew should not be done, never, never, never.
why ?

> that���s why we have new and basicNew :)

the space may be needed during #initialize.
this is why the initialization of the space is done in
basicNew.
But ok, we will fix that.
Thanks
Alain

>
> Esteban
>
>> On 25 Feb 2016, at 09:52, stepharo <stepharo@free.fr> wrote:
>>
>> BlElement class>>basicNew
>>   "Redefined to set the space of the element"
>>
>>   ^ super basicNew basicSpace: BlUniverse default runningSpace
>>
>> why redefining new is not enough?
>>
>> Ok now back to the mooc videos :(
>>
>>
>
>