TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Colin Paul Gloster <[log in to unmask]>
Reply To:
Mon, 29 Jul 2002 13:05:08 +0100
TEXT/PLAIN (158 lines)
(Technical as this is, it definitely falls into the remit of
Ada advocacy, so I am posting this to Team Ada. The
following is also being sent to news:comp.lang.ada along
with one more paragraph for someone probably not subscribed
to Team Ada.)

(The Java language advocate in the subject title is not me, and is not so
naive as to suggest that any Java implementations are yet of sufficient
quality to trust an unmanned orbiting craft with, but he hopes they will
be in future. For the record, his preferences include in descending
order: Java; C++; Ada 95; and Ada 83 (so at least he acknowledges that
there is not simply Ada, it was followed by Ada 95.))

Does anyone have any advice on this topic (given that a C++ base of his
which he happily ported to Java used loads of MI though Java does not
support full blown (i.e. implementation too) MI, this expert has dismissed
using Ada 95 for a particular approach he has chosen for which his
solutions have an affinity to MI)? Any alternate ideas to published ideas
quoted below?, or have you come across any rumors that any of these have
been discredited?, or any favorites?

"Experiences in Object-Oriented Programming" (Panel),
S. Barbey (Ed.), first published in Charles B. Engle Jr. (Ed.),
TRI-Ada '95 Conference Proceedings, Anaheim, California, USA, 5-10
November 1995, pp. 194-199, available for free at and from
for a charge mentioned Tucker Taft's examples and later has:

"[..] the claimed usefulness of multiple inheritance. (Ironically the C++
Booch Components had multiple inheritance designed out of them by the time
Stroustrup's book went to print!)"

S. Barbey again individually is someone to have mentioned Tucker Taft's
examples in the rationale, and claimed that an example of a type derived
from Ada.Finalization[Limited_]Controlled where neither its type nor
enclosing type are being controlled too given in the paper is a case where
other languages require multiple inheritance but Ada 95 does not. ("Ada 95
as Implementation Language for Object-Oriented Designs", revised 18
October 1995,

Barbey later gave an example of using a generic for using only particular
properties of an object in particular circumstances, which again is
something he believed other languages would encourage multiple inheritance

The paper drew to a close with "We have also shown that multiple
inheritance is not necessary in most cases where it would be needed in
other object-oriented programming languages."

Another reason some desire multiple inheritance is for multiple
classification... "It is intersting to note that, where available,
multiple inheritance (MI) is often used for the purpose of such multiple
classification, i.e. for cases of multiple, cross-referencing
catalogues. But MI is not necessarily the best tool, since for instance a
famous area of dispute is what "repeated inheritance" should
mean. [..]". That quote is from a revised version of Magnus Kempe's
"Heterogeneous Data Structures and Cross-Classification of Objects with
Ada 95" which shows an approach doable in C and used in many C books to
show how linked lists etc. may be implemented.

HTTP:// is based on an article
by Edmond Schonberg and dismisses the need for MI, but is not as
comprehensive as some of the material already referenced.

He went in to more detail with Bernard Banner in their TRI-Ada '92
"Assessing Ada 9X OOP" paper.It is archived not many hyperlinks away from
Therein they said

"[..] ([..] placing semaphores in a
sequential data structure to insure its correctness in a
multithreaded environment). This is the context in which
multiple inheritance is usually said to be indispensable. Ada
9X only supports single inheritance, and our challenge was
to obtain reasonable factorization and code reuse in its
absence. The object-oriented mechanisms of Ada 9X are
sufficiently rich to make this possible in most cases."

but that

"uses of multiple inheritance to inherit several interfaces cannot be
ruled out
but they seem to be less common and those will be awkward to model in Ada

For TRI-Ada '94's "Implementing internal program representations with Ada
and Ada 9X", Arthur G. Duncan claimed that there is an MI mapping to Ada
83 which loses compile-time checking, but then came up with an Ada 9X
mapping keeping compile-time checking. See
if you do not have it in hardcopy.

In the Java and Ada paper by Ben Brosgol entitled "A comparison of the
object-oriented features of Ada 95 and Java" (TRI-Ada 1997,
) there is nothing particularly extra in the MI stakes (though the variety
of approaches in Ada for different aspects is not mentioned, generics are
presented as if they are the only way) but "Interestingly, Java uses
inheritance (from Object) to simulate generics, whereas Ada uses generics
to simulate multiple inheritance. The languages were opting to avoid
semantic and implementation complexity, but at the cost of some complexity
for the user" is worth a chuckle.

I may also check out "A systematic approach to multiple inheritance
implementation" by J. Templ in "ACM SIGPLAN Notices", Volume 28 ,  Issue 4
(April 1993) which seems to be indexed but archived online at the moment
but it is probably already available to me in hardcopy.

Norman Cohen reported that no compelling reason to include MI in Ada was
found in two workshops... news:[log in to unmask] ,
16 Oct 89 13:57:09 GMT archived at
HTTP://[log in to unmask]&lr=&hl=en

Tucker Taft posted


There are basically three distinct situations associated
with multi-inheritance mixins:

  1) The case where the mix-in provides components
     and operations, and any overriding of these operations
     needs only to look at the components of the mix-in itself.

  2) The case where the mix-in provides components and operations,
     and some of the overriding of these operations needs access
     to the whole object, rather than just the components of the mix-in.

  3) Like (2), and in addition, any object with the mix-in must
     be able to be linked onto a list (or into some similar
     heterogeneous data structure) of other objects with the same mix-in.

Case (1) is handled completely in Ada 9X by a record or private extension,
with the type being mixed in (in a possibly extended form) as a
component of the record extension.

Case (2) is handled with a generic, that takes any type in
a given class (formal derived type), adds components (via extension)
and operations, and then reexports the extended type.  The new operations
have access to the whole object, not just to the components
being added.

Case (3) is handled with an access discriminant, that provides
access to the enclosing object for the operations of the mix-in,
while still allowing links through the mix-in.  Generics can
also be used to simplify the definition.


on 11 Sep 92... news:[log in to unmask] ,
[log in to unmask]&lr=&hl=en" target="_blank">[log in to unmask]&lr=&hl=en

Thanks for feedback and pointers and hearsay.