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-14 16:33:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!chi1.webusenet.com!news.webusenet.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!feed.cgocable.net!read1.cgocable.net.POSTED!53ab2750!not-for-mail From: "Warren W. Gay VE3WWG" Newsgroups: comp.lang.ada References: <3F5F7FDC.30500@attbi.com> <3F636281.7010509@attbi.com> Subject: Re: Can MI be supported? (Was: Is the Writing on the Wall for Ada?) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Sun, 14 Sep 2003 19:33:02 -0400 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read1.cgocable.net 1063582726 24.150.168.167 (Sun, 14 Sep 2003 19:38:46 EDT) NNTP-Posting-Date: Sun, 14 Sep 2003 19:38:46 EDT Organization: Cogeco Cable Xref: archiver1.google.com comp.lang.ada:42503 Date: 2003-09-14T19:33:02-04:00 List-Id: "Robert I. Eachus" wrote in message news:3F636281.7010509@attbi.com... > Warren W. Gay VE3WWG wrote: > > > CONCLUSION: > > > > In any case, I think MI _CAN_ be supported, where someone > > were to address the "MI qualification" issue in a way that > > can be agreed to. > > If you look at the mix-in example I just posted you can use the names of > the intermediate packages to get at the different operations. For > example if Size and Color had both been derived from integers, then > > Set(Some_Object,2); --would be ambiguous; > Set(Some_Object, Color'(2)); -- fine > Set(Some_Object, Color(2)); -- okay, due to preference rule. > My_Color.Set(Some_Object, 2); -- also works. > My_Resize.Set(Some_Object, 2); -- still ambiguous. Although I can't really say that I have ever made use of mixin inheritance yet, I can see its value. However, when I look at the example of "Sibling Inheritance (Multiple classification)", as described in: http://www.adahome.com/9X/OOP-Ada9X.html#HDR11.2.%20%20Mixin%20Inheritance52 I start to gag on it's messy nature, and like C++ templates, I am left begging for a simpler, more elegant answer. > > Did I miss other problem(s) with MI that qualification ... > The problem with double direct inheritance has to do with membership > properties. With direct inheritance, say from types A and B, you need > to be able to view an object as as if it isa A and isa B. So where is > the problem? It is in the transitivity of isa. In Ada there are many > ways to create a new type or subtype which either subset or exend the > parent type, but only one method of preserving the transitive isa > relationship: > > subtype A is B; > ... > If type C is derived from B and also from A, as can occur with mix-ins > and interface inheritance: > > type A is ...; > type B is new A [with ...]; > type C is new B [with ...]; > X: C := ...; > Y: A := ...; > > Then X isa member of C, X isa member of B'Class, and X isa member of > A'Class, but a Y is not necessarily a member of C'Class, or even > viewable as a member of A'Class, and all is well in the world. Agreed. > If > somehow you added a notation for direct inheritance from two different > types or classes you would have any C isa A and any C isa B, and > therefore any A isa B. Hmmm... see comments later.. ... > In Ada we have gone the extra mile so that you can do view conversions > on objects to an ancestor type. So even when you derive from a tagged > type and add state, you can still do a view conversion and look at an > object of the child type as if it isa member of the parent's class. Right, but where is the conflict in MI in this? If I "convert" C to B, then why not let me look at the "B" view using MI? If I convert C to A, then why not allow me the use of the "A" view? ... > Could we allow in Ada a new construct: > > subtype A is B with C; > ... > type A is new B with C, D, E; > X: A := ...; > Y: B := ...; > ... > X := A(Y); -- legal > > This way A extends B, there exist views of X as a B, C, D, or E. Y can > be converted to an A. The interfaces are part of the type extension of B > into A, and there are no transitivity problems: Yes, a little confusing, but I see. OK, so MI can mess up the "is a" test if I understand correctly (it leads to "incompatible logical conclusions"). So why not add "has a" test? Then you could test if instance V "has a" X, Y or Z component. You could also say that V is "not is a" X, Y or Z, since clearly it is not any one of them by themselves. -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg