About KCP and automatic initialize
Julian Fitzell
julian at beta4.com
Mon Sep 15 03:11:36 UTC 2003
Avi Bryant wrote:
> 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.
Absolutely. I read that as "must call its superclass' designated
initializer if it wants that initialization performed; nothing else will
call it otherwise".
Julian
--
julian at beta4.com
Beta4 Productions (http://www.beta4.com)
More information about the Squeak-dev
mailing list
|