Ways of new

Yoshiki.Ohshima at acm.org Yoshiki.Ohshima at acm.org
Tue May 6 21:55:50 UTC 2003


  Hello,

> However, what I am not clear on is why someone would
> choose an implementation of 'super new' over 'self
> basicNew'? Especially, when one is aware that the
> latter is less risky, as Derek indicated?

  What I meant by "resistance" was more like "phychological
resistance."  One may just hesitate to use #basicWhatever, if he can
achieve the same goal without using it.

> >  By the way, Aoki-san once suggested that a
> definition something like
> >  
> >  new
> >  ^ (super new) initialize; yourself
> >  
> >  is more intention revealing because it clearly shows that the object
> >  to be returned is the one which is newly created. At least, if you
> >  want to initialize your object with a method that returns something
> >  other than self, this is a solution.
> 
> So, is an expression of clarity is the reason for
> choosing 'super new' as opposed to 'self basicNew'
> despite a potential future risk?

  Ah, no.  This "by-the-way" thing was focused on the usage of
#yourself and was not directly related to your question.

new
    ^ (self basicNew) initialize; yourself

would precisely describe what to be done.

  The reason whether to use basicNew or new in the new method sounds
like the theory of evolution.  If it works in both ways at this
moment, the natural selection process doesn't get rid of either way.

-- Yoshiki



More information about the Squeak-dev mailing list