comp.lang.ada
 help / color / mirror / Atom feed
* package dependence question
@ 2000-05-29  0:00 Carl Banks
  2000-05-29  0:00 ` Robert Dewar
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Carl Banks @ 2000-05-29  0:00 UTC (permalink / raw)


Okay, when I program, I like to construct large, dynamic tree
structures.  I like my trees to be traversible in any direction, so if
you're sitting on a node, you can access its parent or any of its
branches.

So let's say that a particular tree has a different type of node at
each level.  For example, type A is the root of the tree.  Its
branches are of type B.  B's branches are of type C, and so on.

Let's also say that A, B, and C are not really similar (they are only
similar in that they are in the same tree structure, but bear no
internal resemblance to each other).  A, B, and C really belong in
separate packages.

However, packages can't with each other, meaning that types A and B
can't store access types to each other if they are defined in separate
packages.  It seems that I have to choose between making the tree
traversible in only one direction, or defining A, B, and C in the same
package.

The best solution I could come up with myself is to make A, B, and C
child packages of a package such as Node, and declaring the types A,
B, and C (and their access types) in the Node package, while declaring
functions and procedures in the child packages Node.A, Node.B, and
Node.C.  This is somewhat messy, as it leaves the fields of type A
open to package Node.B, but at least it isolates the functions and
procedures.

My question is, is there a better way to define such a doubly-
traversible tree, so that different node types need not be defined in
the same package?

Thanks.

 
-- 
        ___\___         ____\___
    \  /      .\    \  /       .\
    |><  Carl  <    |><  Banks  <
    /  \_____)_/    /  \______)_/




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

end of thread, other threads:[~2000-06-03  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-29  0:00 package dependence question Carl Banks
2000-05-29  0:00 ` Robert Dewar
2000-05-29  0:00 ` Jeff Carter
2000-05-29  0:00   ` Ray Blaak
2000-05-29  0:00 ` Antonio Dur�n Dom�nguez
2000-06-03  0:00   ` Robert I. Eachus
2000-05-30  0:00 ` Robert A Duff
2000-05-30  0:00   ` Brian Rogoff
2000-05-30  0:00   ` Ray Blaak

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