The problems with MI are basically the same as manual memory management: (a) to easy to shoot yourself and anyone near you and (b) hinders composability/encapsulation.
The problem is, if you have multiple inheritance then from now on people probably need to know what classes any class they inherit from inherit from themselves, since you may be introducing the same base classes from different hierarchies points.
There are ways to deal with it of course, but for me it is a red flag that maybe I am walking down the wrong road when I see such things. Especially when an "interfaces with default implementations" seems to work so well.
From: Matthew Fulmer tapplek@gmail.com Reply-To: The general-purpose Squeak developers listsqueak-dev@lists.squeakfoundation.org To: The general-purpose Squeak developers listsqueak-dev@lists.squeakfoundation.org Subject: Re: election details *PLEASE READ* Date: Thu, 1 Mar 2007 00:32:32 -0700
On Fri, Feb 23, 2007 at 10:35:35PM -0800, Andreas Raab wrote:
Early on I thought the same way (and this was why we started thinking down that road when Nathanael interned with us). However, in practice it seems like Traits are mostly being used as a thinly veiled version of MI with all the same problems. You have correctly pointed out that Java interfaces are "nothing but abstract virtual base classes in C++" - which coincidentally, was the only way that MI ever worked in C++, which itself has two dozen ways of doing MI wrong and exactly ONE to do it right (abstract virtual base classes). Java choose a stand on that and it worked (which is pretty impressive given that it was the first language that used interface to that extent). Traits seem to reintroduce a number of ways of using MI wrongly (at least that's the feeling that I get when I look at the practical example) and that's why I prefer interfaces.
Forgive me, but I am not familiar with "All the problems Multiple Inheritance got wrong". I will be testing out how Multiple Inheritance works in Squeak, since I have made it my top priority to get ThingLab [1] working in a recent Squeak system. ThingLab adds multiple inheritance [2] and a constraint solver to Smalltalk, and both have at least a good theoretical reason to be there, but I cannot test the implementation yet, since such a change currently breaks squeak. Multiple Inheritance has at least a solid theory; I have not had much experience with an implementation.
[1] http://wiki.squeak.org/squeak/607 Links to ThingLab papers and code.
[2] http://www.2share.com/thinglab/ThingLab%20-%20Chapter%203.html Chapter 3 of the ThingLab paper. Section 2 contains a defense of ThingLab's multiple inheritance.
-- Matthew Fulmer -- http://mtfulmer.wordpress.com/ Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
_________________________________________________________________ With tax season right around the corner, make sure to follow these few simple tips. http://articles.moneycentral.msn.com/Taxes/PreparationTips/PreparationTips.a...