[Newbie] Morph class>>new
Cees de Groot
cg at cdegroot.com
Tue Apr 15 13:57:03 UTC 2003
On Tue, 2003-04-15 at 15:13, Stephane Ducasse wrote:
> > I
> > see so much code with 'super new initialize' makes me wonder - is there
> > something wrong with 'self basicNew initialize'?
> Yes there is. [...]
Sorry - but from the rest of your story, you seem to make an argument
pro 'self basicNew initialize' in Object>>new, and then go on to show
'super new initialize'. The case here is not on whether you want to have
'make = allocate + setup' (I'm fully in agreement here), but which of
the two idoms is 'better' to have in, say, Object. The case is that
'self basicNew initialize' puts the responsibility of calling the
super's initialize in the initialize method itself, whereas 'super new
initialize' does not do that and therefore may risk, in some cases as
indicated by others, double initialization.
Jon - I don't send #basicFoo either willy-nilly. However, 'self basicNew
initialize' is a method that I put at the top of my class hierarchy,
once. I think that's allowed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030415/cd78bffb/attachment.pgp
More information about the Squeak-dev