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-28 01:23:26 PST Path: news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.stueberl.de!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: Sun, 28 Sep 2003 10:28:52 +0200 Organization: gnade.sourceforge.net Message-ID: <4nii41-067.ln1@boavista.snafu.de> References: <1064595326.831730@master.nyc.kbcfp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.eusc.inter.net 1064737406 19184 213.73.71.231 (28 Sep 2003 08:23:26 GMT) X-Complaints-To: abuse@eusc.inter.net User-Agent: KNode/0.7.1 Xref: news1.google.com comp.lang.ada:61 Date: 2003-09-28T10:28:52+02:00 List-Id: Matthew Heaney wrote: > Hyman Rosen writes: > >> Using inheritance for iterators is silly and wrong, since the base >> iterator class can't express anything about what it iterates over, or >> what type it returns. >> >> Go see the Charles library for how to do it right. > > Amen to that. He needs a generic algorithm, but just doesn't know how > to express it in Ada. Use the Source, Luke! > > This is not the point! The point is, that i like to setup a repository of concepts, which is specialized when it is used. For example, the iterator (or enumerator) is a very general concept which requieres basicaly the following methods First - Return the first element Next - Fetch the next element HasMoreElement - Check if there is more By introducing a set of concepts i like to standarize the conding. For example the arugment between two developers already start with naming of the method HasMoreElements. In order to avoid such discussions i like to introduce interface class as for example in java. The nice thing about java interfaces is that all classes are derived from the Object class. This is not the case in Ada, there i dont have such a thing as the Object class. And it seems that i need use generics making the handling a little bit complicated because: 1. Define a generic package with your abstract interface which has a type as argument. 2. Specialize the interface for the requiered type, which is still abstract. 3. Implement classes around the specialzed types. I am looking for a way of avoiding step 1.