comp.lang.ada
 help / color / mirror / Atom feed
* advice on package design
@ 2005-03-07 16:23 spambox
  2005-03-07 21:08 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 28+ messages in thread
From: spambox @ 2005-03-07 16:23 UTC (permalink / raw)


Hello,
I've written a package for linked list operations for my personal use.
After a while I figured I'd write another package for some string
operations that I use frequently. On their own, they both work well.
Now comes the problem.
My string library uses my linked list library, which must be
instantiated -- the structure of a node must be supplied. After that,
the string library can use procedures from the linked list library. But
what about the end user? The linked list library defines a type, say
linked_list, and the string library instantiates it something like:

type word is record ...
package string_ll is new linkedlists(word);
use string_ll;

Ultimatelly, if some function from my strings package returns a
linked_list (as defined in the linked list package), it will be of the
type string_ll.linked_list, if we follow the above example. How could
it be available for further processing with routines from the linked
list package?

I could "use string_ll" (exactly as in the package) in my end program,
however that's probably a poor design, since the user need not know how
something was instantiated in another package.
If, on the other hand, I make another instance of linkedlist, I must
supply the same argument the string package does ("word" in the above
example), but then the resulting linked_list type would be
some_new_name.linked_list, which is not compatible with what the string
package uses (string_ll.linked_list in the example).

What is the correct way of dealing with such problems?

Thanks,

 andrej




^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2005-03-22 10:55 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-07 16:23 advice on package design spambox
2005-03-07 21:08 ` Dmitry A. Kazakov
2005-03-08 12:48   ` spambox
2005-03-08 17:18     ` Dmitry A. Kazakov
2005-03-12 19:57   ` Robert A Duff
2005-03-12 20:45     ` Dmitry A. Kazakov
2005-03-12 21:59       ` Robert A Duff
2005-03-13  9:23         ` Dmitry A. Kazakov
2005-03-16 20:41           ` Robert A Duff
2005-03-17 10:22             ` Dmitry A. Kazakov
2005-03-17 14:04               ` Robert A Duff
2005-03-17 15:59                 ` Dmitry A. Kazakov
2005-03-17 19:10                   ` Robert A Duff
2005-03-17 19:47                     ` Martin Dowie
2005-03-17 20:55                       ` Robert A Duff
2005-03-17 21:14                         ` Marius Amado Alves
2005-03-18  9:31                           ` Martin Dowie
2005-03-18  9:38                         ` Martin Dowie
2005-03-21 16:19                           ` Robert A Duff
2005-03-17 20:48                     ` Dmitry A. Kazakov
2005-03-17 21:26                       ` Robert A Duff
2005-03-18  3:06                         ` Jared
2005-03-18 10:00                         ` Dmitry A. Kazakov
2005-03-21 16:17                           ` Robert A Duff
2005-03-21 18:16                             ` Dmitry A. Kazakov
2005-03-21 20:35                               ` Robert A Duff
2005-03-22 10:55                                 ` Dmitry A. Kazakov
2005-03-17 23:23                 ` Randy Brukardt

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