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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,baa6871d466e5af9 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: AQ&S Guidance on pragma Elaborate_Body Date: 1997/04/24 Message-ID: #1/1 X-Deja-AN: 237236852 Distribution: world References: <528878564wnr@diphi.demon.co.uk> <5jabeq$3ltk@info4.rus.uni-stuttgart.de> <5jfukp$lda@top.mitre.org> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-04-24T00:00:00+00:00 List-Id: In article , jsa@alexandria (Jon S Anthony) wrote: >>>A trivial example is two packages, each of whose bodies with's the others >> >spec, which is not that uncommon. >> >> It may be true that it "is not that uncommon," but mutual dependency of >> packages indicates that you have a pair of highly cohesive abstractions, >> and they should really be combined into a single package. > >Hmmm, you're probably about the only one left here that believes this. >The "withing problem" (and this is for SPECS, not just the above sort >of case) has been discussed here extensively and the general consensus >is that this inability (to define mutually dependent types across >package boundaries) is a hole in the language. You're right, I'm not especially passionate about wanting to define mutually recursive types across package boundaries. I think it's a cool idea, though. One of the tricks C++ programmers do is to pass a reference to an object as a method parameter. That way, you don't have to #include the other class because you know an address is going to get passed. Knowing that tagged types are passed by reference, perhaps we could avoid a spec dependency on the package containing a tagged type's declaration: with Q.T is tagged limited private; package P is type S is private; procedure Op (OS : in out S; OT : in Q.T); -- OT is passed by reference ... In this example, spec deferral makes sense. Sometimes, though, you have closely-related abstractions - maybe the dependency is in one direction only, or maybe they're "merely" logically cohesive - and they just sort of belong together. Of course, avoiding unnecessary compilation dependencies is A Very Good Thing, especially in Ada, where value semantics is the norm, and heap allocation is to be avoided. So there is a very real tension between the need to minimize compilation dependencies, and the desire to minimize the "declaration span" between closely-related types. Yes, we have to program real systems on real computers, but it's still humans that have to do it. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271