Ways of new
Anthony Adachi
adachipro at yahoo.com
Tue May 6 21:38:27 UTC 2003
Yoshiki wrote:
> At Mon, 5 May 2003 23:10:43 -0700 (PDT),
> Anthony Adachi wrote:
> > Derek Brans wrote:
> > > I think 'super new initialize' runs the risk
of initializing the objectmore than once
> > If that is the case is there any reason in
particular
> > that an author might wish to use 'super new
> > initialize' rather than 'self basicNew'?
> There is a resistance to *use* #basic... in your
code. It sometimes
> means that your code is not well-factored so it has
to bypass a
> standard mechanism.
Yes, I recognize that the question might be whether
one should be overriding a standard mechanism in the
first place and that one's code may be asking to be
refactored.
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?
> 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?
Thanks,
Anthony
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
More information about the Squeak-dev
mailing list
|