comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Help : Circular dependency
Date: Mon, 25 Nov 2002 19:30:26 GMT
Date: 2002-11-25T19:30:26+00:00	[thread overview]
Message-ID: <3DE27A83.1050803@acm.org> (raw)
In-Reply-To: d40d7104.0211251039.3746c561@posting.google.com

prashna wrote:
> Can anybody explain, with example, What is circular dependecy?

with B;
package A is
    type T is (Ay, Has, Tipe, Tee);
    procedure Op (P1 : in T; P2 : in B.T);
end A;

with A;
package B is
    type T is (Bee, Has, Tipe, Tee);
    procedure Op (P1 : in T; P2 : in A.T);
end B;

A depends on B, and B depends on A.

You can remove this by moving one of the type declarations up to a 
parent package (or moving the operations to a child package):

package A is
    type T is (Ay, Has, Tipe, Tee);
end A;

with B;
package A.Ops is
    procedure Op (P1 : in T; P2 : in B.T);
end A;

with A;
package B is
    type T is (Bee, Has, Tipe, Tee);
    procedure Op (P1 : in T; P2 : in A.T);
end B;

Now A does not depend on B, and B does not depend on A.Ops, so there is 
no circularity.

-- 
Jeff Carter
"Death awaits you all, with nasty, big, pointy teeth!"
Monty Python & the Holy Grail




      parent reply	other threads:[~2002-11-25 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-25 18:39 Help : Circular dependency prashna
2002-11-25 19:23 ` Robert A Duff
2002-11-25 19:30 ` Jeffrey Carter [this message]
replies disabled

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