ambiguous inheritance question

Dave at Dave at
Fri Feb 3 07:38:41 UTC 1995

> Dear Self interest group,
> What are peoples opinions on the following:
> given an inheritance hierarchy as below:
>                A
>               / \
>              B   C
>               \ /
>                D
> where B and C are parents of D, and A is the parent of B and C,
> If A defines slot m, and B defines its own version of slot m, if you send D 
> the message m, you get an ambiguous selector error (as expected).
> How about if D got the m in B, because it does override the one in A,
> after-all. What I mean is that the m in B overrides the very same slot m that
> D inherits via C. If it was a different m that it was overriding I'd be
> totally happy with an ambiguous selector error.
> What do you think? Would the proposed scheme invite obscure bugs? Would it
> be difficult to understand? You may think that this sort of situation doesn't
> occur often enough to be a problem - maybe true - but dispite that, what do
> you think?

What if D is using the m it inherited from B to hold a restricted
type of string that has to have a certain format, then you call a
method f inherited from A which modifies m without respecting the
restricted string format required by B?

Dave Yost

More information about the Self-interest mailing list