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,309015504ed37ff0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-29 21:48:33 PST Path: news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!npeer.de.kpn-eurorings.net!eusc.inter.net!news.eusc.inter.net!boavista.snafu.de!news From: Michael Erdmann Newsgroups: comp.lang.ada Subject: Re: Usage of Interfaces with Ada 95 Date: Tue, 30 Sep 2003 06:57:24 +0200 Organization: gnade.sourceforge.net Message-ID: References: <1064595326.831730@master.nyc.kbcfp.com> <4nii41-067.ln1@boavista.snafu.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.eusc.inter.net 1064897312 29432 213.73.71.169 (30 Sep 2003 04:48:32 GMT) X-Complaints-To: abuse@eusc.inter.net User-Agent: KNode/0.7.1 Xref: news1.google.com comp.lang.ada:285 Date: 2003-09-30T06:57:24+02:00 List-Id: Matthew Heaney wrote: > Michael Erdmann writes: > >> ........ I my example i like to provide a package >> enumerator where the developer X can put in his data type, but the >> gerneric package forces him to implement the interface for his data >> type and nothing else. If the semantic of this interface is simple, it >> will be mutch easier for somebody else to maintain the code written on >> this concept. > > You still haven't groked the static polymorphism idea. > > If I have the following generic algorithm: > > generic > type Iterator_Type is private; > with function Succ (Iterator : Iterator_Type) > return Iterator_Type is <>; > with procedure Process (Iterator : Iterator_Type) is <>; > with function "=" (L, R : Iterator_Type) > return Boolean is <>; > procedure Generic_Algorithm (First, Back : Iterator_Type); > > Then of course this is going to check how iterators are declared by > independent developers -- as soon as he tries to instantiate the generic > algorithm. Any iterator any developer builds must conform to this > logical interface. Thanks for your example! I assume, that the procedure Generic_Algorithm is containing some kind of implementation of an iterator based on the input parameters of the generic? You are right, this provides a standarized interface, but i guess the procedure Generic_Algorithm contains some kind of implementation of an iteration based on the methods specified in the input? I think the is a different view on the topic by defining a functionality of an interface, providing a generic implementation which defines the interface for the programmer. This was exactly what i dont like to do. I dont like to spent the effort of breaking down a concept into a generic implementation. This is the reason why i like to use interfaces. Regards M.Erdmann