On 25 Feb 2016, at 12:32, Alain Plantec via Pharo-dev <pharo-dev@lists.pharo.org> wrote:


From: Alain Plantec <alain.plantec@yahoo.com>
Subject: Re: [Pharo-dev] [bloc] why redefining new is not enough?
Date: 25 February 2016 at 12:37:59 GMT+1
To: Pharo Development List <pharo-dev@lists.pharo.org>



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 ?

well��� is not forbidden, of course��� 
but many frameworks use basicNew as a way of obtain *explicitly* non-initialized objects (voyage does that, for instance). 


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.

you can define new as: 

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

that���s perfectly fine :)

other possibility is to lazy initialise space with the default universe. 

Esteban

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 :(