About KCP and automatic initialize

Avi Bryant avi at beta4.com
Sun Sep 14 23:12:47 UTC 2003


On Mon, 15 Sep 2003, Richard A. O'Keefe wrote:

> >>>>>	- The designated initializer must call its superclass' designated
> 	initializer.
>
> There is an implicit assumption here, which is that superclass
> initialisation is always (but ALWAYS) appropriate for subclasses.
>
> This is very often true.  One might even say that it is usually true.
> But in a language like Smalltalk, where the superclass initialisation
> method may call instance methods that are overridden by the subclass,
> it is certainly not a *safe* assumption.

True, and good to keep in mind.  Note that with the conventions I
outlined, every initialization (even when just sending #new) goes through
the default initializer for the subclass.  So if you knew that the
superclass initialization was not appropiate, you could leave out the
super call.

So "must call its superclass' designated initializer" should be a little
more qualified, but the general design holds.

Avi



More information about the Squeak-dev mailing list