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,c5e219ab41be8c00 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-02 13:27:44 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsxfer.eecs.umich.edu!news.bu.edu!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: Multiple Interface Inheritance (was Re: JGNAT and ObjectAdaand...) Date: Tue, 02 Jan 2001 16:27:43 -0500 Organization: AverStar (formerly Intermetrics) Burlington, MA USA Message-ID: <3A5247CF.E694B80F@averstar.com> References: <3A3E8A9E.D12673A7@libertysurf.fr> <91nur2$ulk$1@nnrp1.deja.com> <3A3F8651.7CDB13B6@averstar.com> <3A410EC1.106C74CC@averstar.com> <3A413FBB.3E852649@averstar.com> <926vah$iu4$1@news.huji.ac.il> NNTP-Posting-Host: nebula.burl.averstar.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 978470863 6472 141.199.8.77 (2 Jan 2001 21:27:43 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 2 Jan 2001 21:27:43 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:3577 Date: 2001-01-02T21:27:43+00:00 List-Id: Brian Rogoff wrote: > ... I still suggested an explict 'Interface or sigof rather > than suggesting inference, which is more powerful yet. All I want to know > is whether the ability to an extract an (anonymous?) interface from an > existing tagged type might reasonably be added to the proposal. There is interest in being able to "extract" or "construct" an interface given an existing type. One of the nice features of Ada generics is that you can instantiate a generic with a type and a set of operations that need not be primitives of the type. The operations can be created locally to match the needs of the generic. For example, you could define a "<" to be used by a sorting generic which determined the kind of ordering desired, but which had nothing to do with the "primitive" < of the type. In my view, the generics of Eiffel are somewhat less powerful because they don't really support this kind of "morphing" or after-the-fact generalization. The interesting question for Ada is whether given the addition of an "abstract interface" capability, could one easily write a generic that essentially added an interface after-the-fact, and also did the "morphing." For example, given the interface Ordered: type Ordered is abstract; function "<"(Left, Right : Ordered) return Boolean is abstract; one could write a generic as follows: generic type T is tagged private; with function "<"(Left, Right : T) return Boolean is <>; package Ordered_Wrapper is type Ordered_T is new T and Ordered with null record; function "<"(Left, Right : Ordered_T) return Boolean; end Ordered_Wrapper; package body Ordered_Wrapper is function "<"(Left, Right : Ordered_T) return Boolean is begin return T(Left) < T(Right); end "<"; end Ordered_Wrapper; Does this solve at least part of the problem you were trying to solve? In any case, feel free to propose something more specific. Although I failed to do this in AI 251, providing clear and convincing examples of use is important to help understand the motivation behind the proposal. > > -- Brian -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Commercial Division, AverStar (formerly Intermetrics) (http://www.averstar.com/services/IT_consulting.html) Burlington, MA USA