is Missing multiple inheritance in sqeak a drawback ?

Nathanael Schärli squeak-dev at lists.squeakfoundation.org
Sat Oct 12 01:02:34 UTC 2002


> What multiple inheritance is supposed to do is good and is needed. 
> But, in practice, it is very unwieldy, etc. 

Or as Alan Snyder said at a OOPSLA '87 panel talk: 
"Multiple inheritance is good, but there is no good way to do it."

> I think there needs to be 
> a kind of "mixing algebra" that would make the semantics of 
> combination clear.

I totally agree. The problem with multiple inheritance is that the
notions of classes and inheritance are used in two different (and
partially contradictory) roles:

Role 1: Classes as behavior that can (usually) be instantiated
- Classes are used to represent behavior that can be instantiated.
Therefore, it makes sense to say that each class needs to inherit from a
common superclass (i.e., Object) that guarantees some basic behavior.
- Inheritance is used as a implementation mechanism to incrementally
create a new class from an existing one by specifying a "delta".

Role 2: Classes as basic building blocks for new classes
- Classes represent basic building blocks for new classes. In this
context, it does not make sense that every class has to inherit from
Object, because it may well be that I just want to create a building
block that *exclusively* contains the methods =, >, <=, ~=, etc. for
"Magnitude".
- Inheritance is used as a fusion of such building blocks.

As Alan pointed out, it would be much better to have kind of a "mixin
algebra" that would have reusable "building blocks" that are distinct
from classes and obey to a well-defined combination semantics.

The "mixins" approach (cf. the work of Gilad Bracha) goes in this
direction: It allows specification of "abstract subclasses" that only
specify the effectively needed methods and fields and can then be
applied to various parent classes. However, this approach still uses the
inheritance for two different concepts, which leads to several other
problems such as fragile hierarchies, especially when mixins are used
more extensively.

Nathanael



> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Alan Kay
> Sent: Friday, October 11, 2002 11:54 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: is Missing multiple inheritance in sqeak a drawback ?
> 
> 
> What multiple inheritance is supposed to do is good and is needed. 
> But, in practice, it is very unwieldy, etc. I think there needs to be 
> a kind of "mixing algebra" that would make the semantics of 
> combination clear.
>       In any case, I think there is a much better way for almost all 
> cases, and that is multiple perspectives. I have mentioned 
> Goldstein's and Bobrow's PIE system (done at PARC in Smalltalk in the 
> late 70s, and some of the papers are available). The current Squeak 
> etoy system has a gesture towards this approach. The basic idea is to 
> make the description of a object be in terms of "perspectives" or 
> "roles" (for example, that of being an object, of being a graphical 
> entity, of being a collection, of having several roles in a 
> particular model, etc.) This is a "sideways" approach to what 
> multiple inheritance does, but for many of the most important cases 
> does not require any kind of inheritance at all (e.g. what class 
> object now supplies in the hierarchy, it supplies as a perspective). 
> Several nice things about this way of looking at things is that it 
> doesn't stop one from using inheritance, it gets rid of inheritance 
> for lots of cases, it makes things clearer, it separates concerns for 
> complicated objects. Another ramification of this POV is that it 
> encourages a different way to look at parameterization and variants 
> without requiring subclassing, etc.
> 
> Cheers,
> 
> Alan
> 
> ------
> 
> At 8:32 PM +0200 10/11/02, Hans Beck wrote:
> >Hi,
> >
> >I'm using squeak for prototyping our LCD measurement system
> >software. From time to time, some colleagues look at my display and 
> >are astonished ;-)) But they are c++ freaks, and if we discuss about 
> >the usability  of squeak for prototyping, always there comes the 
> >argument of lacking multiple inheritance.
> >
> >So because I'm not a theoretican for computer languages but  I
> >suppose there are a lot very good guys on this list, I would ask the 
> >community, how far multiple inheritance is really needed, or is it 
> >bad or what ever ? (Looking from a more or less theoretical 
> >viewpoint of object oriented concepts ) ?
> >
> >Thanks for help finding arguments :-))
> >
> >Greetings
> >
> >Hans
> 
> 
> -- 
> 




More information about the Squeak-dev mailing list