TextEditor initialization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TextEditor initialization

Stephan Eggermont-3
Is there a specific reason why

TextEditor>>initWithMorph: aMorph
       
        super initialize.
        morph := aMorph.
        self resetState.

calls super initialize instead of self initialize?

TextMorph uses that with its subclass SmalltalkEditor as

TextEditor class>>forMorph: aMorph

        ^ self basicNew initWithMorph: aMorph

Stephan


Reply | Threaded
Open this post in threaded view
|

Re: TextEditor initialization

Marcus Denker-4

> On 30 Jul 2015, at 11:15, Stephan Eggermont <[hidden email]> wrote:
>
> Is there a specific reason why
>
> TextEditor>>initWithMorph: aMorph
>
> super initialize.
> morph := aMorph.
> self resetState.
>
> calls super initialize instead of self initialize?

#initialize seems to be not implemented in the hierarchy anyway.

>
> TextMorph uses that with its subclass SmalltalkEditor as
>
> TextEditor class>>forMorph: aMorph
>
> ^ self basicNew initWithMorph: aMorph
>

I would

- change basicNew to new in forMorph:
- remove the call to #initialize in #initWithMorph: as it is done by #new

        Marcus


Reply | Threaded
Open this post in threaded view
|

Re: TextEditor initialization

Marcus Denker-4
https://pharo.fogbugz.com/f/cases/16073/TextEditor-initialization

On 30 Jul 2015, at 12:00, Marcus Denker <[hidden email]> wrote:


On 30 Jul 2015, at 11:15, Stephan Eggermont <[hidden email]> wrote:

Is there a specific reason why

TextEditor>>initWithMorph: aMorph

super initialize.
morph := aMorph.
self resetState.

calls super initialize instead of self initialize?

#initialize seems to be not implemented in the hierarchy anyway.


TextMorph uses that with its subclass SmalltalkEditor as

TextEditor class>>forMorph: aMorph

^ self basicNew initWithMorph: aMorph


I would

- change basicNew to new in forMorph:
- remove the call to #initialize in #initWithMorph: as it is done by #new

Marcus