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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Class-wide types algebra Date: Wed, 28 Sep 2016 09:31:59 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <2837d915-12c8-4c23-8907-1d146d1abae7@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:31915 Date: 2016-09-28T09:31:59+02:00 List-Id: On 28/09/2016 02:05, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:nr8rah$14gp$1@gioia.aioe.org... >> ... E.g. >> >> type Root_Stream_Type is ... >> >> OK, that was a mistake, it should have been >> >> type Root_Stream_Interface is limited interface; >> type Root_Stream_Type is abstract new Root_Stream_Interface >> with private; > > We would have made the above change years ago if it wasn't severely > incompatible. > >> With T'Interface you could still work it around: > > But you'd still have the problem that interfaces can't be hidden (which is > the source of the incompatibility). And lifting that restriction would be a > nightmare (we've tried on several occasions), as you quickly get scenarios > where you have to have two different copies of the same interface in order > to keep sanity about the operations. (Else one has to totally abandon > privacy, allowing hidden operations to be overridden. That leads to usage > madness...) That is largely because interfaces were introduced as named types, which was an error as well as introducing them at all. T'Interface would be an anonymous type like T'Class is. There is no danger of having its copies because it is a by-structure thing and all copies are same. > The problem with all forms of MI is diamond inheritance, which get much > worse in Ada because of our strict privacy rules. There is no any problems with diamond inheritance and visibility. > I don't think that could > ever be solved for Ada (perhaps a new language could solve it, but not Ada). It can easily be solved once understood that inheritance may produce conflicts to be resolved by the programmer, not by the language, which is indeed impossible. Use-clauses, nesting, generic formals have *exactly* same issues there is absolutely nothing special in inheritance. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de