comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <lucretia9@lycos.co.uk>
Subject: Re: Implementing an Ada compiler and libraries.
Date: 11 May 2007 10:39:46 -0700
Date: 2007-05-11T10:39:46-07:00	[thread overview]
Message-ID: <1178905186.012787.167150@y80g2000hsf.googlegroups.com> (raw)
In-Reply-To: <4644179d$1_5@news.bluewin.ch>

On May 11, 8:14 am, Gautier <gaut...@fakeaddress.nil> 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.




  reply	other threads:[~2007-05-11 17:39 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 14:37 Implementing an Ada compiler and libraries Lucretia
2007-05-09 16:51 ` Dmitry A. Kazakov
2007-05-09 17:21   ` Lucretia
2007-05-10  7:59     ` Dmitry A. Kazakov
2007-05-10  8:51       ` Duncan Sands
2007-05-10 17:39       ` Lucretia
2007-05-10 18:06         ` Lucretia
2007-05-10 19:30           ` Dmitry A. Kazakov
2007-05-11  7:14           ` Gautier
2007-05-11 17:39             ` Lucretia [this message]
2007-05-11 17:43               ` Lucretia
2007-05-11 18:20                 ` Robert A Duff
2007-05-11 18:49                   ` Lucretia
2007-05-11 20:34                     ` Georg Bauhaus
2007-05-11 22:37                       ` Lucretia
2007-05-11 22:06                     ` Robert A Duff
2007-05-11 22:41                       ` Lucretia
2007-05-16 19:40                 ` Randy Brukardt
2007-05-09 20:48 ` Robert A Duff
2007-05-10  3:38   ` Lucretia
2007-05-16 19:58   ` Randy Brukardt
2007-05-09 21:15 ` Gautier
2007-05-10  3:39   ` Lucretia
2007-05-10 15:34   ` Stefan Bellon
2007-05-10 16:25     ` Jean-Pierre Rosen
2007-05-10 17:07       ` Ludovic Brenta
2007-05-10 17:14         ` Stefan Bellon
2007-05-10 16:37     ` Ludovic Brenta
2007-05-10 16:43       ` Stefan Bellon
2007-05-10 16:49         ` Ludovic Brenta
2007-05-10 17:02           ` Stefan Bellon
2007-05-10 19:57             ` Jacob Sparre Andersen
2007-05-10 20:31             ` Simon Wright
2007-05-10 17:37       ` Pascal Obry
2007-05-11 10:09         ` Ludovic Brenta
2007-05-11 16:33           ` Pascal Obry
2007-05-10 17:36     ` Pascal Obry
2007-05-10 17:42     ` Lucretia
2007-05-10 17:34 ` Pascal Obry
2007-05-10 17:48   ` Lucretia
2007-05-10 20:01   ` Duncan Sands
2007-05-10 21:00     ` Pascal Obry
2007-05-11 11:04       ` Duncan Sands
2007-05-13 12:03         ` Ludovic Brenta
2007-05-10 21:00     ` Pascal Obry
2007-05-11  8:39   ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox