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-Thread: 103376,104df2b9b7a2f689 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 17 May 2005 18:18:39 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <8764xj9wzf.fsf@deneb.enyo.de> <877jhz0y52.fsf@deneb.enyo.de><87sm0mcjbx.fsf@deneb.enyo.de><1rfnp5x3lxi3n$.mvahuo5ag68a$.dlg@40tude.net><87u0l26rww.fsf@deneb.enyo.de> <87zmutsenr.fsf@deneb.enyo.de> Subject: Re: Interfaces Date: Tue, 17 May 2005 18:21:12 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-NhWk9nV/0p+11M00XzFUUltC7LLtRihI8gmJpiu46t8ZvI/9fowLLKszd3qSF1ytmM/FvLDeQ6t+edm!bd+4kxIebRNWRpxqIKlI9zOkuvUN+N9vwnJfy8czFzctEAW/O/84nqiQe3iHMKWkR3m62ZMfzGBv X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:11074 Date: 2005-05-17T18:21:12-05:00 List-Id: "Florian Weimer" wrote in message news:87zmutsenr.fsf@deneb.enyo.de... ... > > Anyway, I thought you were worried about the case where T implements J1 > > and J2, both of which have type-conformant Foo's. And you override them > > separately. Then it's clear which one you dispatch to from J1'Class > > and J2'Class. But if you have an object X of type T, which overriding > > does Foo(X) call? > > My knee-jerk reaction is: require a type conversion in all cases. > Probably unacceptable if you want to compete with Java. 8-> Interfaces are a weird beast, rather different from the other sort of types in Ada. They really have a fairly global scope, and even more interesting, the number of times or the place that you inherit them doesn't have any effect on their semantics. Because of that, they are only usable when there is no chance of needing more than one implementation. (For instance, sorting would be a bad use for an interface, because you may want to sort the same type in more than one way. But you can't do that with interfaces.) Similarly, the operations need to have well-defined semantics. And if multiple interfaces have the same operation; it is the *same* operation. Essentially, all of the operations of all of the interfaces in a program are a global grouping -- *you* have to keep the names separate. Because of these issues, I find interfaces to be a concept with very limited utility. They're mostly useful for things that otherwise wouldn't have any way to share code (such as tasks or protected objects with different implementations). I just wasn't going to win the fight to keep them out of Ada 2006. (Of course, in 5 years someone will stick this note in my face when I'm advocating some sort of interface programming. I'm prepared. :-) Randy Brukardt.