From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35b23727c41f3e62,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-29 05:05:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!kibo.news.demon.net!demon!newshub1.nl.home.com!news.nl.home.com!amsnews01.chello.com!newsfeed.wxs.nl!transit.news.xs4all.nl!131.211.28.48.MISMATCH!news.nl.linux.org!humbolt.nl.linux.org!news.utwente.nl!surfnet.nl!feeder.news.heanet.ie!193.1.198.47.MISMATCH!not-for-mail Newsgroups: comp.lang.ada From: Colin_Paul_Gloster@ACM.org (Colin Paul Gloster) Subject: Multiple interface inheritance workaround in Ada 95 / Ada 0x to satisfy a Java language advocate? Reply-To: Colin_Paul_Gloster@ACM.org Message-ID: User-Agent: slrn/0.9.7.0 (SunOS) Organization: Dublin City University (DCU) Cache-Post-Path: ns2-ext.dcu.ie!unknown@camac.dcu.ie X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) Date: 29 Jul 2002 12:05:20 GMT NNTP-Posting-Host: 136.206.1.1 X-Trace: 1027944320 reader.news.heanet.ie 229 136.206.1.1 Xref: archiver1.google.com comp.lang.ada:27444 Date: 2002-07-29T12:05:20+00:00 List-Id: (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 http://www.Adahome.com/Resources/Papers/OO/experiences_in_oop.ps.Z and from HTTP://portal.ACM.org/citation.cfm?id=376572&coll=portal&dl=ACM&CFID=3601926&CFTOKEN=30407690 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, HTTP://WWW.Adahome.com/Resources/Papers/OO/ada95_as_il_for_ood-revised.ps.Z .) 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 for. 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://WWW.AdaIC.org/whyada/ada-vs-c/ada-vs-c.html 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 HTTP://portal.ACM.org/citation.cfm?id=143593&coll=portal&dl=ACM&CFID=3601926&CFTOKEN=30407690 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 9X." 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 HTTP://portal.ACM.org/citation.cfm?id=197716&coll=portal&dl=ACM&CFID=3601926&CFTOKEN=30407690 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, HTTP://portal.ACM.org/citation.cfm?id=269652&coll=portal&dl=ACM&CFID=3601926&CFTOKEN=30407690 ) 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:8910161521.AA27039@ajpo.sei.cmu.edu , 16 Oct 89 13:57:09 GMT archived at HTTP://groups.Google.com/groups?safe=images&ie=UTF-8&oe=UTF-8&as_umsgid=8910161521.AA27039@ajpo.sei.cmu.edu&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:1992Sep11.182034.26753@inmet.camb.inmet.com , http://groups.google.com/groups?safe=images&ie=UTF-8&oe=UTF-8&as_umsgid=1992Sep11.182034.26753@inmet.camb.inmet.com&lr=&hl=en . Hyman Rosen may be particualrly expert in pointing out what MI in C++ boasts over Ada. ("I [Hyman Rosen] can't speak for anyone else, but I use C++ because I love it. I am at my current job because I answered an ad which was looking for expert C++ programmers, and it sounded (and is) exactly like what I wanted. I find the combination of multiple inheritance, [..] to result in remarkably concise, expressive, efficient, and typesafe code which is moreover a lot of fun to write. It more than makes up for the warped C-legacy syntax.", news:3D0DF19E.5010805@mail.com ) Thanks for feedback and pointers and hearsay.