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 X-Google-Thread: 103376,1592759aa83d0d45 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-28 19:13:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!propagator-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail Message-ID: <3ED56CA9.6050301@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: MI in Ada 200X (was: Suggestion for Ada 200x - Interface inheritance) References: <0Pxza.699607$OV.652508@rwcrnsc54> <4a4de33a.0305280557.5d5aba37@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1054174387 24.62.164.137 (Thu, 29 May 2003 02:13:07 GMT) NNTP-Posting-Date: Thu, 29 May 2003 02:13:07 GMT Organization: AT&T Broadband Date: Thu, 29 May 2003 02:13:07 GMT Xref: archiver1.google.com comp.lang.ada:37965 Date: 2003-05-29T02:13:07+00:00 List-Id: M�rio Amado Alves wrote: > Everybody wants class MI. The reasons it was left out of Ada 95 and > 83, the cons, are weaker than the pros. So every Adaist whishes to see > it in Ada 200X. I must not be everybody. Ada currently supports the mix-in model of multiple inheritance. I sometimes have a type declaration followed by half a dozen mixins: type Visible is tagged private; private type Foo is abstract tagged record...end record; type Foo1 is new Mixin1(Foo,...); type Foo2 is new Mixin2(Foo1,...); type Foo3 is new Mixin3(Foo2,...); ... type Visible type is new MixinN(FooN,...); I've even used multiple instances of the same mixin, for example a sparse array implementation which used two instances of the same linked list package. (The matricies I was working with were sparse enough that walking a list was probably faster than using a tree index. But I could have added two AVL tree mixins if necessary with little change to the code.) The only problem I have with this approach is the need to come up with all those intermediate type names. (But the names are necessary, you have to use them in the calls to the various mixins. Even if you could use the name of the generic, it could be ambiguous, as in the sparse matrix example. But Bar(Foo2(Object)) calls the right Bar operation. I have no objection to adding the interface abstraction to Ada, but to me in is a solution to problems other than MI.