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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,691503f3d2c9213d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.190.247.MISMATCH!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Sun, 13 Apr 2008 18:49:25 -0400 From: "Peter C. Chapin" User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Question about circular elaboration order error (GNAT). References: <48024d11$0$19786$4d3efbfe@news.sover.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <48028df4$0$19860$4d3efbfe@news.sover.net> Organization: SoVerNet (sover.net) NNTP-Posting-Host: 4261eead.news.sover.net X-Trace: DXC=fo50aU58=LLRZfJoa3=8@NK6_LM2JZB_C[_1ciVdeH_B3?@`i3kGa5K2nbeCo2?jAMQ=\C8@lkWeA X-Complaints-To: abuse@sover.net Xref: g2news1.google.com comp.lang.ada:20925 Date: 2008-04-13T18:49:25-04:00 List-Id: Robert A Duff wrote: > The stricter rules are conservative, and modular -- when compiling > Parent, it sees that you're calling Parent.Child, and assumes the worst > WITHOUT looking at Parent.Child body. For example, it assumes that > Parent.Child might call Dummy, causing a real cycle. Thanks to you and Samuel Tardieu for your replies. They do help to clarify things for me somewhat. It is easy for me to understand how Parent.Child's body would have an elaboration dependency on Parent's spec, but I did not expect Parent.Child's body to necessarily have an elaboration dependency on Parent's body. Are you saying that it doesn't (necessarily) have such a dependency in standard Ada, but that I'm experiencing an example of GNAT's stricter rules? In any event I got my example to work with an appropriate application of pragma Elaborate. I guess I didn't stumble into the right combination in my earlier tinkering. It helps to have a better idea of what is happening. :-) > I suggest you read the section in the GNAT docs about elaboration. > It explains all this stuff in great detail. Yes, actually I read that stuff, but I didn't see anything in particular about elaboration dependencies between parent and child packages. >> Note my actual program involves a task in the parent that is trying to >> use subprograms in the child. However, the difficulties I'm having >> appear to be unrelated to tasking. > > Don't be too sure. Tasks get activated "early", and can easily cause > elab cycles. Look at the docs for details. I'm not saying that the errors in the tasking example (my real program) are wrong. Indeed, I assumed there was some non-trivial stuff going on during elaboration that was stimulating the error. I was just glad when I could (apparently) reproduce the problem with a simpler example. That makes it easier to study, of course. Peter