comp.lang.ada
 help / color / mirror / Atom feed
From: Carl Banks <oaf@psu.edu>
Subject: package dependence question
Date: 2000/05/29
Date: 2000-05-29T00:00:00+00:00	[thread overview]
Message-ID: <8gt19i$1cm8@r02n01.cac.psu.edu> (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  <
    /  \_____)_/    /  \______)_/




             reply	other threads:[~2000-05-29  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-29  0:00 Carl Banks [this message]
2000-05-29  0:00 ` package dependence question Robert Dewar
2000-05-29  0:00 ` Antonio Dur�n Dom�nguez
2000-06-03  0:00   ` Robert I. Eachus
2000-05-29  0:00 ` Jeff Carter
2000-05-29  0:00   ` Ray Blaak
2000-05-30  0:00 ` Robert A Duff
2000-05-30  0:00   ` Ray Blaak
2000-05-30  0:00   ` Brian Rogoff
replies disabled

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