> On 25 Feb 2016, at 12:32, Alain Plantec via Pharo-dev 
> <[email protected]> wrote:
> 
> 
> From: Alain Plantec <[email protected]>
> 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 <[email protected]>
> 
> 
> 
>> On 25 févr. 2016, at 11:49, Esteban Lorenzano <[email protected]> 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 <[email protected]> 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 :(
>>> 
>>> 
>> 
>> 
> 
> 
> 
> 

Reply via email to