Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!sdd.hp.com!mips!apple!snorkelwacker!mit-eddie!uw-beaver!ssc-vax!bcsaic!lbaum From: lbaum@bcsaic.UUCP (Larry Baum) Newsgroups: comp.sys.mac.programmer Subject: Re: Multiple Inheritance -- Is It A Luxury? Message-ID: <27553@bcsaic.UUCP> Date: 6 Jul 90 16:38:12 GMT References: <42616@apple.Apple.COM> <2691908E.738C@intercon.com> <42665@apple.Apple.COM> Organization: Boeing Computer Services AI Center, Seattle Lines: 79 In article <42665@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes: : : >Used properly, multiple inheritance : >can be very useful in decomposing problems over orthgonal axes (for example, : >take a look at the "mixin" concept in several Lisp object platforms). Used : >improperly, you can end up with the "it's a floor wax AND a dessert topping" : >effect... : Symbolic Lisp Machines have a wonderful class in the UI called a : Listener. It inherits from 26 different classes, sometimes through : multiple different paths in the inheritance graph. It's impossible : to subclass properly or even figure out how to take advantage of its : functionality (in case one wanted to do the same thing). It might be impossible for you, but it certainly isn't in general. I think the key point is that without multiple inheritance, Symbolics probably wouldn't have come up with this class which you admit is wonderful. The flavor components of Lisp-Listener are: W:LISP-LISTENER W:LISTENER-MIXIN W:INTERACTOR-MIXIN W:LISTENER-MIXIN-INTERNAL W:PROCESS-MIXIN SI:STANDARD-VALUE-ENVIRONMENT-MIXIN W:WINDOW W:BORDERS-MIXIN W:LABEL-MIXIN W:ESSENTIAL-LABEL-MIXIN W:MARGIN-HACKER-MIXIN W:MINIMUM-WINDOW W:ESSENTIAL-EXPOSE W:ESSENTIAL-ACTIVATE W:ESSENTIAL-SET-EDGES W:ESSENTIAL-MOUSE W:STREAM-MIXIN SI:DISPLAY-INPUT-EDITOR SI:INTERACTIVE-STREAM SI:LINE-OUTPUT-STREAM-MIXIN SI:CHARACTER-STREAM SI:BIDIRECTIONAL-STREAM SI:INPUT-STREAM W:SELECT-MIXIN W:GRAPHICS-MIXIN W:ESSENTIAL-WINDOW W:SHEET SI:OUTPUT-STREAM SI:STREAM GRAPHICS:RASTER-GRAPHICS-MIXIN GRAPHICS::DRAWING-STATE-GRAPHICS-MIXIN GRAPHICS:STANDARD-GRAPHICS-MIXIN W:GRAPHICS-COMPATIBILITY-MIXIN FLAVOR:VANILLA Without going thru each one individually, each of these mixins provides different sets of behaviors which are for the most part orthogonal; e.g. Listener-mixin makes the lisp listener a separate process with a READ-EVAL-PRINT loop and the ability to understand command processor commands. Borders mixin takes care of how and when to draw or redraw borders on windows, label-mixin takes care of window labels, etc. It is true that often a method (i.e. the function that runs in response to a message) is a complex combination of individual methods contributed from each mixin and it can be difficult (but certainly not impossible) to figure out how they combine. That is why Symbolics includes a workbench of extremely powerful tools such as the Flavor Examiner, Inspector, etc. I would certainly agree that object-oriented languages permitting multiple inheritance should be bundled with such powerful tools. Of course, it is multiple inheritance that makes the building of those tools much more feasible. -- Larry Baum Advanced Technology Center Boeing Computer Services uucp: uw-beaver!bcsaic!lbaum (206) 865-3365 internet: lbaum@atc.boeing.com