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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Elaboration order handling (Was: Bug in 'gnatmake') Date: Wed, 19 Jun 2013 18:09:24 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> <87r4g0g9c0.fsf@adaheads.sparre-andersen.dk> <87ip1bg4z2.fsf_-_@adaheads.sparre-andersen.dk> <53d0b070-a03b-43d0-a560-68dd3a8bebf5@googlegroups.com> <51c218df$0$6623$9b4e6d93@newsspool2.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 20 Jun 2013 01:04:22 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="ea9e222491b6e4ac16c72e6c1b727e42"; logging-data="1474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18r1+Tdrza9gxRE4HFIgeVNVRpPttfaMKE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Cancel-Lock: sha1:6JIigEpOSKwuDFT5JXRQEBprFN4= X-Original-Bytes: 2800 Xref: number.nntp.dca.giganews.com comp.lang.ada:181974 Date: 2013-06-19T18:09:24-07:00 List-Id: Since we're discussing elaboration order, there's a case that I wonder about: with B; package A is function F (I : Integer) return B.Thing; function R return Integer; end A; package body A is function F (I : Integer) return B.Thing is -- null; begin -- F return B.To_Thing (I); end F; function R return Integer is -- null; begin -- R return 7; end R; end A; package B is type Thing is private; function To_Thing (I : Integer) return Thing; private -- B type Thing is new Integer; end B; with A; package body B is function To_Thing (I : Integer) return Thing is -- null; begin -- To_Thing return Thing (I); end To_Thing; C : constant Integer := A.R; end B; It seems to me there's a valid elaboration order for these: * spec of B * spec of A * body of A * body of B I've never been able to get such code to bind, though. Is there some way to get this accepted, or is it illegal Ada? -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail 07