comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Adding functions to generic package
Date: Sat, 28 May 2005 16:27:46 GMT
Date: 2005-05-28T16:27:46+00:00	[thread overview]
Message-ID: <upsvbz56m.fsf@earthlink.net> (raw)
In-Reply-To: 429891d3$1@news.broadpark.no

Preben Randhol <randhol+cla@pvv.org> writes:

> I'm using the charles library which has a generic list package. I
> would like to add two procedures Randomise and Move so that all my
> lists can use them. I cannot modify the library itself, so what
> choices do I have?  Is making a child package the only way to add the
> procedures in a generic way?

If you want to take advantage of the representation of the list
container type, then you would have to create a child.  Otherwise, if
your algorithm can be implemented in terms of the already-existing
(primitive) operations of the type, then it doesn't have to be a child.

You could do something like:

with Charles.Lists.Double.Unbounded;

generic
   with package P is new Charles.Lists.Double.Unbounded (<>);
  use P;
package Generic_List_Ops is
   procedure Randomize (Container : in out Container_Type);
   procedure Move (...);
end;


If these are truly generic algorithms, then you could implement them as,
well, generic algorithms, and then either use those as is, or use them
to implement the generic package above.

What do Randomize and Move do?  If you have a tentative implementation,
then post it (or just mail it to me) and we can figure what is the best
option for you.

-Matt



  reply	other threads:[~2005-05-28 16:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-28 15:44 Adding functions to generic package Preben Randhol
2005-05-28 16:27 ` Matthew Heaney [this message]
2005-05-28 18:18   ` Preben Randhol
2005-05-28 18:20     ` Preben Randhol
2005-05-29  0:56     ` Matthew Heaney
2005-05-29  8:41       ` Preben Randhol
2005-05-29 14:37         ` Matthew Heaney
2005-05-29 21:31           ` Preben Randhol
2005-05-29 21:33             ` Preben Randhol
2005-05-29 22:30               ` Matthew Heaney
2005-05-30 20:45                 ` Preben Randhol
2005-05-30 22:28                   ` Marius Amado Alves
2005-06-01  1:50                     ` Matthew Heaney
2005-06-02 12:49                       ` Marius Amado Alves
2005-06-02 13:11                         ` Matthew Heaney
2005-06-01  1:41                   ` Matthew Heaney
2005-05-29 22:27             ` 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