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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-10 00:22:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.news.qwest.net!namche.sun.com!news1brm.central.sun.com!new-usenet.uk.sun.com!not-for-mail From: olehjalmar kristensen - Sun Microsystems - Trondheim Norway Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: 10 Sep 2003 09:13:19 +0200 Organization: Sun Microsystems Inc., http://www.sun.com/ Message-ID: References: NNTP-Posting-Host: khepri06.norway.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: new-usenet.uk.sun.com 1063177999 7980 129.159.112.195 (10 Sep 2003 07:13:19 GMT) X-Complaints-To: usenet@new-usenet.uk.sun.com NNTP-Posting-Date: 10 Sep 2003 07:13:19 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:42340 Date: 2003-09-10T07:13:19+00:00 List-Id: >>>>> "AK" == Alexander Kopilovitch writes: AK> olehjalmar kristensen wrote: >> In fact, one of the *nice* things about the C++ multiple >> inheritance is that it allows me to express roles (a la Reenskaug) and >> then combine different roles in the same object without jumping >> through hoops. AK> Combining different roles in the same object may be a good thing AK> as far as those roles do not interfere with each other. AK> But in reality they may interfere by subtle and unforeseen way, AK> in some singular points of the problem space. Therefore it is Of course, that's why I said you needed some care. However, in practice, there will be little or no overlap, and thus little chance of interference, precisely because you have modeled the different roles properly. Also, you will typically use multiple virtual inheritance via one common base class to allow the different roles to interact. I'm talking about multiple inheritance as a tool for combining carefully modeled, largely orthogonal roles in a single object, not as a tool for grabbing whatever functionality happens to be in some class. AK> generally important (for the kinds of projects, for which Ada was AK> primarily designed) to maintain organized responsibility among AK> the roles, and this naturally leads to strict prioritization of AK> individual role's authority and responsibility. Single inheritance AK> ideally provides that prioritization, while full-scale multiple AK> inheritance symmetrically spreads responsibilty among several AK> ancestors, and did not provide any guidance for resolving of AK> apparent conflicts between the roles. >> In Smalltalk you need an extra tool to do this, in C++ >> all you need is a little care. I suppose it *could* be done in Ada >> with generics, but I have not tried it, and it would certainly be more >> obfuscated. AK> Well, sometimes it may be done with generics, but anyway you may AK> always use straightforward delegation instead of multiple inheritance. AK> In fact, a delegation adds not so much code, and do not harm readability AK> (assuming regular attentive reading, not a brief glance). Sure, you can always use delegation, and obtain precisely the same interface to the object as if you had used multiple inheritance. But then you are really just implementing it yourself. I can do that in C too. No need for inheritance at all, really. I actually did this in a project in the early eighties as we only had C, not Simula or some other object oriented language available on our Unix system. AK> Alexander Kopilovitch aek@vib.usr.pu.ru AK> Saint-Petersburg AK> Russia