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 07:58:08 PST Path: news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Usage of Interfaces with Ada 95 Date: 29 Sep 2003 10:52:01 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <1064595326.831730@master.nyc.kbcfp.com> <4nii41-067.ln1@boavista.snafu.de> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1064847297 943 128.183.235.92 (29 Sep 2003 14:54:57 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 29 Sep 2003 14:54:57 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: news1.google.com comp.lang.ada:164 Date: 2003-09-29T14:54:57+00:00 List-Id: Michael Erdmann writes: > Matthew Heaney wrote: > > 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 Perhaps you would like the alternate approach to this whole idea that I used in SAL: http://www.toadmail.com/~ada_wizard/ada/sal.html. There, a "container" is not a rigidly defined type, it is just a concept. Containers are anything that can be used with the set of generic algorithm packages. I'm not clear SAL is what you want, but it is different enough from Charles and Booch Components that it may give you some ideas on how to express what you want in Ada. I suspect part of what you want will be provided by Ada0Y Interfaces. > The nice thing about java interfaces is that all classes > are derived from the Object class. Hmm, that's not what I do in SAL, so you probably won't like it. I believe Charles works that way, though. > This is not the case in Ada, there i dont have such a thing as the > Object class. But can declare one, and use it everywhere. > 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. You have to declare your abstract interface somewhere, even in Java. > 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. I'm confused. Perhaps you can give an example of what you want in Java, and then show your attempt to implement it in Ada. That would make this discussion much clearer. -- -- Stephe PS I'm on vacation for a week starting tomorrow, so I may respond to posts this week.