comp.lang.ada
 help / color / mirror / Atom feed
From: kevin  cline <kevin.cline@gmail.com>
Subject: Re: Design - cyclic dependencies
Date: Wed, 31 Oct 2007 22:16:43 -0000
Date: 2007-10-31T22:16:43+00:00	[thread overview]
Message-ID: <1193869003.239741.196820@v3g2000hsg.googlegroups.com> (raw)
In-Reply-To: <1193401560.389194.282030@o3g2000hsb.googlegroups.com>

On Oct 26, 7:26 am, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
> Consider:
>
> --  a.ads:
> package A is
>    type T is new Integer;
>    procedure P;
> end A;
>
> --  a.adb:
> with B;
> package body A is
>    procedure P is
>       X : T;
>    begin
>       B.P (X);
>    end P;
> end A;
>
> --  b.ads:
> with A;
> package B is
>    procedure P (X : A.T);
> end B;
>
> --  b.adb:
> package body B is
>    procedure P (X : A.T) is
>    begin
>       null;
>    end P;
> end B;
>
> There are two logical modules A and B, implemented as packages.
> There is no cyclic dependency between the specifications of these
> packages and the code is legal.
> Still, there is a design-level cyclic dependency between the whole
> modules in the sense that A depends on B (A calls some operation of B)
> and that B depends on A (B uses some type from A).
>
> Being legal does not imply being good and therefore I ask: do you
> consider this kind of design-level cyclic dependency to be acceptable?

I have no idea what you mean by 'logical module' or 'design-level
cyclic dependency'.  But circular package dependencies are never
acceptable to me.  I would either combine A and B into a single
package, or else break the circularity by moving T into B.




      parent reply	other threads:[~2007-10-31 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 12:26 Design - cyclic dependencies Maciej Sobczak
2007-10-26 14:28 ` Robert A Duff
2007-10-27  0:09 ` anon
2007-10-31 22:16 ` kevin cline [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