comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: Usage of Interfaces with Ada 95
Date: 29 Sep 2003 10:52:01 -0400
Date: 2003-09-29T14:54:57+00:00	[thread overview]
Message-ID: <uhe2vwstq.fsf@nasa.gov> (raw)
In-Reply-To: 4nii41-067.ln1@boavista.snafu.de

Michael Erdmann <Michael.Erdmann@snafu.de> 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!
> > 
> > <http://home.earthlink.net/~matthewjheaney/charles/>
> 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.



  parent reply	other threads:[~2003-09-29 14:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-26 16:36 Usage of Interfaces with Ada 95 Michael Erdmann
2003-09-26 16:50 ` chris
2003-09-26 16:55 ` Hyman Rosen
2003-09-26 19:10   ` Michael Erdmann
2003-09-26 20:37     ` Hyman Rosen
2003-09-27 15:05       ` Michael Erdmann
2003-09-28  2:11         ` Matthew Heaney
2003-09-29  2:25         ` George Shapovalov
2003-09-28  2:14   ` Matthew Heaney
2003-09-28  8:28     ` Michael Erdmann
2003-09-28 14:33       ` Matthew Heaney
2003-09-28 15:09         ` Michael Erdmann
2003-09-28 21:50           ` Matthew Heaney
2003-09-30  4:57             ` Michael Erdmann
2003-09-30 10:02               ` Mário Amado Alves
2003-09-30 12:31               ` Matthew Heaney
2003-09-30 19:58                 ` Michael Erdmann
2003-09-28 17:10         ` Simon Wright
2003-09-28 21:52           ` Matthew Heaney
2003-09-28 21:58           ` Matthew Heaney
2003-09-29 19:37             ` Georg Bauhaus
2003-09-29 19:45               ` Georg Bauhaus
2003-09-30  7:10               ` Preben Randhol
2003-09-29 20:11             ` Simon Wright
2003-09-29 22:56               ` Matthew Heaney
2003-09-30 14:53                 ` Matthew Heaney
2003-09-30 16:13                   ` Preben Randhol
2003-09-29 13:49           ` Matthew Heaney
2003-09-28 18:22       ` Robert I. Eachus
2003-09-29  3:02         ` Hyman Rosen
2003-09-30  3:11           ` Robert I. Eachus
2003-09-30 13:38             ` Hyman Rosen
2003-09-30 21:46               ` Robert I. Eachus
2003-09-30 22:10                 ` Hyman Rosen
2003-10-01  2:30                   ` Robert I. Eachus
2003-10-01  2:41                   ` Robert I. Eachus
2003-10-01 13:21                     ` Hyman Rosen
2003-10-01 17:01                       ` Robert I. Eachus
2003-10-01 18:46                       ` Matthew Heaney
2003-09-29 14:52       ` Stephen Leake [this message]
2003-09-29 23:00         ` Matthew Heaney
2003-09-30 12:49           ` Marin David Condic
2003-09-30 23:48             ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox