From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,58f5085c2edafcfe,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!o3g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Design - cyclic dependencies Date: Fri, 26 Oct 2007 05:26:00 -0700 Organization: http://groups.google.com Message-ID: <1193401560.389194.282030@o3g2000hsb.googlegroups.com> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" X-Trace: posting.google.com 1193401560 14035 127.0.0.1 (26 Oct 2007 12:26:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 26 Oct 2007 12:26:00 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20071019 Red Hat/1.5.0.12-0.7.el4 Firefox/1.5.0.12 pango-text,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: o3g2000hsb.googlegroups.com; posting-host=137.138.37.241; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2578 Date: 2007-10-26T05:26:00-07:00 List-Id: 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? If not, what measures would you recommend to correct it? Extracting T to another package is probably the only reasonable option, but then there are variants of it (child or sibling package, etc.). -- Maciej Sobczak * www.msobczak.com * www.inspirel.com