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,20144c9b38aef82d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.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: Wed, 19 Oct 2005 16:47:19 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <4354EF40.9010906@mailinator.com> <43552495.2050300@obry.net> Subject: Re: About 0Y interfaces Date: Wed, 19 Oct 2005 16:51:21 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: <2cudnQu4z6l6I8veRVn-hA@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-H46zm+sBSKfBiz8jQjqj4xz39yYV0XFrkfh3kpVbL6QI8ARj0t1dQNUs0JZ8WOxdz8OVnTUoFYabkTV!eChz1KqNiSlX6/7xqh1SI/iTf/wexp9lniQ3VtGGtgVWlWHh4XVuM7BZZIUxCh1/dhaCIvgdcLZe 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:5809 Date: 2005-10-19T16:51:21-05:00 List-Id: "Brian May" wrote in message news:sa4irvtlvr3.fsf@snoopy.microcomaustralia.com.au... > >>>>> "Randy" == Randy Brukardt writes: > > Randy> Personally, I find implementation inheritance to be more > Randy> useful than interface inheritance, but obviously others > Randy> feel differently. And, in any case, interfaces allow using > Randy> OOP with tasks and protected types, which wasn't a > Randy> possibility in Ada 95. > > How? > > (yes... ok... my imagination is limited tonight...) Task types and protected types can inherit from interfaces. There are rules for matching operations declared in those types with the primitive operations of the interfaces (it's called "implemented by..."). And of course, all of the OOP things work on Interface'Class. In addition, dispatching procedure calls can be used as an entry in timed and conditional entry calls, and ATC. This gives the effect of dispatching entry calls without having to have such a construct. In addition, there are specific kinds of interfaces (task interfaces, protected interfaces, synchronized interfaces [for which the implementation must be a task or protected type]); they guarentee that the concrete type is the right kind of thing.Task interfaces can be used as a task (in an abort statement, the prefix of 'Completed and 'Terminated, and in the task id package). What you can't do is derive from a task or protected type that has an interface. That is, there is no implementation inheritance, only interface inheritance. We had looked at ways to provide implementation inheritance for protected types, but they suffered from real problems of composition. We eventually concluded that interface inheritance works fine, and it is quite useful by itself, so that's what was provided. The advantage of avoiding any implementation inheritance is that all of the locking code for a PT is located in one place -- so analyzing its correctness (and applying optimizations) can be done simply by reading the code (no hidden magic). Determining that a PT has the correct behavior is quite difficult without any inheritance; it would be nearly intractable with it. How long it will be before compilers provide all of this is another question. I suspect that it will be a fairly low priority for many implementers. Randy.