From: spambox@volja.net
Subject: advice on package design
Date: 7 Mar 2005 08:23:58 -0800
Date: 2005-03-07T08:23:58-08:00 [thread overview]
Message-ID: <1110212638.336123.298580@l41g2000cwc.googlegroups.com> (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
next reply other threads:[~2005-03-07 16:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-07 16:23 spambox [this message]
2005-03-07 21:08 ` advice on package design 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox