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,35b23727c41f3e62 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-30 12:18:11 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Multiple interface inheritance workaround in Ada 95 / Ada 0x to satisfy a Java language advocate? Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 30 Jul 2002 19:17:53 GMT References: <1028042914.262359@master.nyc.kbcfp.com> <3D46CE25.5010102@worldnet.att.net> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:27493 Date: 2002-07-30T19:17:53+00:00 List-Id: Jim Rogers writes: > I am not strong on C++ so I will deal with the Java example above. > All Java objects are accessed through references. This is equivalent > to having all Ada object accessed through access to class types. To mimic Java in this way, it seems that (in addition to what you said above), you have to derive everything ultimately from one root type. This happens automatically in Java, but in Ada it requires planning ahead, which is impossible when combining two independently-developed pieces of code. > The Ada equivalent for a tagged type is: > > type I1_Access is access all I1'Class; > type I2_Access is access all I2'Class; > > procedure f(item : in I1_Access) > temp : I2_Access; > begin > if item.all in I2'Class then But this is illegal, unless I1 and I2 are "related" to each other. > temp := item; This needs to be "temp := I2_Access(item);", which is again illegal in the same circumstance. > end if; > end f; > > Note that this performs a lookup similar to what you describe. By the way, the ARG is working on a feature that mimics Java's interfaces (i.e., multiple inheritance without the pain), but I don't think it does what Hyman Rosen wanted. (OK, he didn't say he *wanted* it; he just said that C++ supports it.) I would like to see an example of why it is wanted. On the face of it, it seems weird to reach off into the far distance and ask whether this thing I have my hands on just *happens* to obey some totally unrelated interface. - Bob