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.

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 <
[email protected]>:

>
>
> ---------- Message transféré ----------
> From: Alain Plantec <[email protected]>
> To: Pharo Development List <[email protected]>
> 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 <[email protected]>
> 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 <[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