comp.lang.ada
 help / color / mirror / Atom feed
* Help : Circular dependency
@ 2002-11-25 18:39 prashna
  2002-11-25 19:23 ` Robert A Duff
  2002-11-25 19:30 ` Jeffrey Carter
  0 siblings, 2 replies; 3+ messages in thread
From: prashna @ 2002-11-25 18:39 UTC (permalink / raw)


Can anybody explain, with example, What is circular dependecy?

Thanks



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

* Re: Help : Circular dependency
  2002-11-25 18:39 Help : Circular dependency prashna
@ 2002-11-25 19:23 ` Robert A Duff
  2002-11-25 19:30 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Robert A Duff @ 2002-11-25 19:23 UTC (permalink / raw)


vashwath@rediffmail.com (prashna) writes:

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

Usually, circular dependency means something like this:

    with B;
    package A is
        ...
    end A;

    with A;
    package B is
        ...
    end B;

which is illegal in Ada.  It would be legal, however, if the "with A;"
were moved to the body of B, or the "with B;" were moved to the body of A.

- Bob



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

* Re: Help : Circular dependency
  2002-11-25 18:39 Help : Circular dependency prashna
  2002-11-25 19:23 ` Robert A Duff
@ 2002-11-25 19:30 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Carter @ 2002-11-25 19:30 UTC (permalink / raw)


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




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

end of thread, other threads:[~2002-11-25 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox