[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: when should sends be virtual?
rainer wrote:
> randy wrote:
> > We were trying to support maximum flexibility. ...
>
> then you defined flexibility as possibilities for the client (child) to
> change the behavior of the server (ancestor). (would YOU want to allow your
> child to alter your behavior? ;-)
No, the child does not alter my behaviour resp. the behaviour of its ancestor.
If a message is addressed to me / the ancestor then whatever the child defines
has no influence.
The child can only modify what it _inherited_ from me and that's the way it
should be! I hope that my son will learn to behave differently from me in
many situations. Unfortunately, that will not automatically change the way
I behave.
> > ... Why would you want to say
> > to a child "you cannot specialize the use of `foo' in this method, even
> > if you want to"? ...
>
> because of reliability reasons, of course.
> ("in a delegation chain, any object may screw up ancestors' semantics."
^^^^^
Ideally one should only care about the protocoll of the _direct_ ancestor(s)
not whether it is implemented in the object itself or inherited from others.
The need to give the programmer a quick overview of all the methods valid for a
particular object is a reason for improving the development environment,
not for changing the language design.