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,91d0d8cd28bbb477 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 11 May 2007 09:14:42 +0200 From: Gautier User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Implementing an Ada compiler and libraries. 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> In-Reply-To: <1178820387.916393.238070@y80g2000hsf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.76.165.218 X-Original-NNTP-Posting-Host: 83.76.165.218 Message-ID: <4644179d$1_5@news.bluewin.ch> X-Trace: news.bluewin.ch 1178867613 83.76.165.218 (11 May 2007 09:13:33 +0200) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!wns13feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news1.google.com comp.lang.ada:15746 Date: 2007-05-11T09:14:42+02:00 List-Id: Lucretia: > Also, allowing multiple compilation units in the same file can be > problematic, e.g. > > package one is ...; > package two is ...; > procedure three is ...; > package body one is ...; > package body two is ...; > > 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... 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 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. 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 HTH ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!