comp.lang.ada
 help / color / mirror / Atom feed
From: NCOHEN@IBM.COM ("Norman H. Cohen")
Subject: Does Ada really need MULTIPLE inheritance?
Date: 16 Oct 89 13:57:09 GMT	[thread overview]
Message-ID: <8910161521.AA27039@ajpo.sei.cmu.edu> (raw)

Two recent workshops focused on adding support for object-oriented
programming to Ada.  One, sponsored by MITRE Corporation, was held
September 11-13 at Woburn, Massachusetts.  The Workshop on Language
Issues for Reuse: Ada for the 90's, sponsored by University of Maine
was held at Deer Isle, Maine, September 25-29.  Specific proposals for
supporting object-oriented programming in Ada were discussed at each
workshop.

I'll leave discussion of the details to the final workshop reports, which
are now in preparation, but I do want to mention two areas of consensus
reached at both workshops:

   (1) Ada should support inheritance.
   (2) There is no convincing need for MULTIPLE inheritance.

Since nobody at either workshop was a strenuous advocate of multiple
inheritance, I would like to see the argument for multiple inheritance
presented here.  Among the thoughts that contributed to the consensus
AGAINST multiple inheritance were:

   (1) In many cases, the effect of multiple inheritance could be
       achieved also by instantiating a generic unit defining a subclass
       of a class given by a generic parameter.  This allows different
       classes to be extended in a uniform way.

   (2) Multiple inheritance may seem essential in some object-oriented
       languages because inheritance is the only importation mechanism.
       Ada can get by with a WITH clause in many contexts where other
       languages use multiple inheritance.  In Eiffel, for example, one
       inherits from class MATH, which has operations but no state data,
       to achieve the effect of WITHing a math package in Ada.

   (3) In some language proposals, multiple inheritance is a natural
       generalization of single inheritance.  In other proposals,
       however, multiple inheritance is difficult to accommodate.
       For example, the view that subclasses should be treated as Ada
       subtypes has much going for it (for details, see my proposal
       "Ada Subtypes as Subclasses," Research Report RC14912, which can
       be obtained by writing to IBM Thomas J. Watson Research Center,
       Distribution Services F-11 Stormytown, P.O. Box 218, Yorktown
       Heights, NY 10598), but it is incompatible with multiple
       inheritance in a strongly typed language like Ada.

   (4) Many (including Bertrand Meyer) hold that the inheritance
       hierarchy should reflect an "is-a" relationship.  That is, each
       instance of a subclass should be an instance of its immediate
       superclass(es) as well.  There are a few well-known examples
       where the "is-a" relationship holds with multiple parents (a text
       window is both a text file and a window, e.g.) but such examples
       are rare, too rare to justify further complication of the
       language.

   (5) Multiple inheritance makes it difficult to determine the source
       of a subclass's features, or to determine the impact of changing
       the interface of a superclass.  It tends to lead to undisciplined
       software composition that may be fine for exploratory programming
       but is unacceptable for the huge projects in which Ada is used,
       projects that require strict configuration management.

Norman Cohen

             reply	other threads:[~1989-10-16 13:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-10-16 13:57 "Norman H. Cohen" [this message]
1989-10-17 17:23 ` Does Ada really need MULTIPLE inheritance? David A Eichmann,316K
1989-10-17 20:49   ` David Chase
1989-10-21 19:39     ` Inheritance & limited private types William Thomas Wolfe, 2847 
1989-10-22  7:00       ` Vinod Grover
1989-10-22 18:03         ` Inheritance & limited private t stt
1989-10-22 20:22         ` Inheritance & limited private types Barry Margolin
1989-10-23  0:39           ` Ted Dunning
1989-10-27 15:44           ` Paul Pedersen
1989-10-27 17:50             ` Robert Firth
1989-10-27 22:32               ` Profiling (was Re: Inheritance & limited private types) Barry Margolin
1989-10-27  0:04         ` Inheritance & limited private types Dick Karpinski
1989-10-30 17:12   ` Does Ada really need MULTIPLE inheritance? Paul Baker
1989-10-19  2:27 ` William Thomas Wolfe, 2847 
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox