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: T'Interface attribute Date: Tue, 8 Aug 2017 08:13:41 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: MajGvm9MbNtGBKE7r8NgYA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:47646 Date: 2017-08-08T08:13:41+02:00 List-Id: On 2017-08-08 00:59, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message >> ... In all contexts where both become visible must require explicit name >> resolution, e.g. by renaming one of the types and/or primitive operations. > > Ada doesn't have type renaming, so this is not possible in general. Not exactly renaming, but a schema to qualify the parent: type T is new I as I1 and new I as I2 with null record; overriding I1 procedure Foo (X : T); overriding I2 procedure Foo (X : T); >>> I've generally materialized that as "the root of an abstraction should >>> always be declared abstract". >> >> Yes, but this is not enough, because it kills potential >> multiple-inheritance cases. > > As an implementer, knowing that multiple-inheritance is just barely possible > to implement, I'm unwilling to consider that unless no other possibility > exists. And some other way always exists. :-) But Ada 2005 did it, so I am happily using it. (:-)) >>> In Claw, the only places that we got much benefit from OOP (beyond >>> dispatching callbacks, the reason we used OOP in the first place) was in >>> sharing implementations across related types. But that doesn't work for Ada >>> interfaces, because you can't have any components in the type -- meaning >>> that writing real implementations is impossible. One can use abstract types >>> in this way (and we did so extensively). >> >> Reuse happens on the client's side, when you share interface-wide >> implementations. This includes helper types which refer to [access] >> I'Class. Surely you have lots of them to pass widgets around, in events, >> in handlers etc. > > Not really. The implementation has such things, but we only exposed > parameters of Root_Window_Type'Class (with a couple of exceptions). The vast > majority of routines only take a single object. If you have a On_Button_Click event handler you want to pass there only implementations from Window_Clickable_Type'Class. Not just any Root_Window_Type'Class. And there is no way to place all they subclasses into single chain of inheritance. Some of Window_Clickable_Type are also Window_File_Selector_Type and Window_DnD_Type etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de