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!news1.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Question about circular elaboration order error (GNAT). Date: Mon, 14 Apr 2008 09:56:03 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <48024d11$0$19786$4d3efbfe@news.sover.net> <48028df4$0$19860$4d3efbfe@news.sover.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1208181364 6407 192.74.137.71 (14 Apr 2008 13:56:04 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 14 Apr 2008 13:56:04 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:ll/505fqFj6Icy39MwI9QPVEykw= Xref: g2news1.google.com comp.lang.ada:20933 Date: 2008-04-14T09:56:03-04:00 List-Id: "Peter C. Chapin" writes: > Thanks to you and Samuel Tardieu for your replies. You're welcome. >...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? Yes. Your original example (with no pragmas added) is legal, and a valid Ada compiler (such as GNAT with -gnatE) will compile and link it just fine. However, it might fail at run time. Worst case: it works fine, but 2 years later, you port it to a new compiler (new machine, or even a new version of the same compiler), and you get a mysterious Program_Error. If you get an elab cycle when you modify your program (e.g., you add a with_clause), it's easy to deal with -- your change is small, and you know it caused the cycle. But if you get a Program_Error when porting a giant program to a new compiler, it can easily take several hours to figure out the problem. - Bob