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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,91d0d8cd28bbb477 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!y80g2000hsf.googlegroups.com!not-for-mail From: Lucretia Newsgroups: comp.lang.ada Subject: Re: Implementing an Ada compiler and libraries. Date: 11 May 2007 10:39:46 -0700 Organization: http://groups.google.com Message-ID: <1178905186.012787.167150@y80g2000hsf.googlegroups.com> References: <1178721451.073700.10730@y80g2000hsf.googlegroups.com> <6819scxft9y4$.1vlh83ppnnyrh$.dlg@40tude.net> <1178731280.075981.23040@u30g2000hsc.googlegroups.com> <8cu67r7wcdn7$.18rtn6g7506w2$.dlg@40tude.net> <1178818792.829214.95870@q75g2000hsh.googlegroups.com> <1178820387.916393.238070@y80g2000hsf.googlegroups.com> <4644179d$1_5@news.bluewin.ch> NNTP-Posting-Host: 62.56.75.195 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1178905186 21950 127.0.0.1 (11 May 2007 17:39:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 May 2007 17:39:46 +0000 (UTC) In-Reply-To: <4644179d$1_5@news.bluewin.ch> User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.10 (X11; Linux i686; U; en),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=62.56.75.195; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news1.google.com comp.lang.ada:15760 Date: 2007-05-11T10:39:46-07:00 List-Id: On May 11, 8:14 am, Gautier wrote: > > What if the body of one or two require the subprogram three? Is this a > > form of forward declaration? Would interleaving specs and body's cause > > problems? Probably. > > Most Ada compilers allow multiple compilation units in the same file. > They are just treated the same way as if they were each in its file. > It would be surprising if this was not described somewhere in the Manual... There isn't as far as I've found. It's implementation dependent. > In your example, three is not visible by the body of one or two. > > package one is procedure z; end; > package two is procedure z; end; > procedure three is begin null; end; > package body one is procedure z is begin null; end; end; > package body two is procedure z is begin three; end; end; > > ObjectAda says to that: > multipack: Error: line 5 col 44 LRM:4.1(3), Direct name, three, is not > visible, Ignoring future references Yeah, my example wasn't complete, just an example ordering I slapped together. > conversely... > > package one is procedure z; end; > package two is procedure z; end; > procedure three is begin null; end; > package body one is procedure z is begin null; end; end; > with three; > package body two is procedure z is begin three; end; end; > > compiles fine. Now, I take it there would be a compiler error if three came after two? > And yes you can put others specs after bodies, just a spec of a package after > its body seems not ok: > > package body one is procedure z is begin null; end; end; > package one is procedure z; end; > > multipack: Error: line 1 col 15 LRM:7.2(4), corresponding package spec not > found, continuing Ok. So, it seems that Aonix just enforces that the dependencies within a file be sorted out by the programmer, and that the specs are always before the bodies. What if you do: package one is ... end one; package two is ... end two; package body one is ... end one; package body two is ... end two; I take it, this is allowed? Thanks, Luke.