comp.lang.ada
 help / color / mirror / Atom feed
* seperate keyword and seperate compilation with Gnat?
@ 1996-07-02  0:00 David Morton
  1996-07-02  0:00 ` Peter Hermann
                   ` (13 more replies)
  0 siblings, 14 replies; 51+ messages in thread
From: David Morton @ 1996-07-02  0:00 UTC (permalink / raw)



I've been working with John Herro's AdaTutor
program on Linux, and gnat.

He uses the keyword seperate a lot, to make the assignment 
procedure in a seperate file, ie,

in file foo.adb  (the test file)
procedure bar is seperate;

then in file foo-bar.adb

seperate(foo) (the assignment file)
procedure bar is
...

He argues that the file foo.adb should be able to be compiled,
seperately, since the specification is there, even though the actual
procedure body has not been written.  I'm inclined to believe that he's right,
but gnat refuses to cleanly compile unless the file foo-bar.adb exists.

Well, here's a snip from an email message he sent me, which explains it better than I can:

from John Herro:
>    "It's an important part of Ada.  A separate subprogram (procedure or
>function) can be part of a package or part of another subprogram.  For
>example, we can improve on the following "Pascal style" code:
>procedure Main is
>   ...
>  procedure Sub(I : in Integer) is separate;
>     ...
>   begin
>      ...
>   end Sub;
>begin
>   ...
>   Sub(3);
>   ...
>end Main;
>The disadvantage of the above is that, if you make any changes to Sub, you
>have to recompile Main.  But if you write the following in two files:
>procedure Main is
>   ...
>   procedure Sub(I : in Integer) is separate;
>begin
>   ...
>   Sub(3);
>   ...
>end Main;
>
>separate (Main)
>procedure Sub is
>   ...
>begin
>   ...
>end Sub;
>then we can change the second file and recompile it without having to
>recompile Main.  Note that Main contains the specification for Sub.  That is,
>the line
>   procedure Sub(I : in Integer) is separate;
>tells the compiler that Sub takes one input parameter of type Integer.
> That's all the information the compiler needs to compile the call to Sub:
>   Sub(3);
>The body of Sub can be compiled later - any time before linking.  Sub can
>still "see" the declarations above it in the main program; it's as if Sub
>were cut out and "pasted" where the main program says "is separate."
>     I've taken advantage of this feature of Ada in several Outside
>Assignments, where the test driver is the main program in one file, and the
>function that the student is writing is a separate subprogram in another
>file. "

Could anyone explain why gnat does not allow this?

-- 
David Morton
 mailto:dmorton@jinx.sckans.edu    // If you use Netscape 2.0,
 205 College, Winfield, KS 67156   // you can click on the mailto: part to reply!
                                   (HINT, HINT)  :)




^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~1996-07-21  0:00 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-02  0:00 seperate keyword and seperate compilation with Gnat? David Morton
1996-07-02  0:00 ` Peter Hermann
1996-07-02  0:00   ` David Morton
1996-07-02  0:00 ` Robert Dewar
1996-07-18  0:00   ` Peter Hermann
1996-07-20  0:00     ` Robert Dewar
1996-07-02  0:00 ` Samuel Mize
1996-07-03  0:00   ` *separate* keyword and *separate* " David Morton
1996-07-03  0:00     ` Robert Dewar
1996-07-03  0:00   ` seperate keyword and seperate " Robert Dewar
1996-07-17  0:00   ` Robert I. Eachus
1996-07-03  0:00 ` Rob Kirkbride
1996-07-03  0:00   ` Robert A Duff
1996-07-03  0:00   ` Robert Dewar
1996-07-08  0:00     ` Robert A Duff
1996-07-08  0:00     ` John Herro
1996-07-08  0:00       ` Robert Dewar
1996-07-10  0:00         ` John Herro
1996-07-10  0:00           ` Robert Dewar
1996-07-08  0:00       ` Robert Dewar
1996-07-09  0:00       ` Robert A Duff
1996-07-09  0:00         ` Robert Dewar
1996-07-09  0:00       ` progers
1996-07-08  0:00     ` michael
1996-07-08  0:00       ` Robert Dewar
1996-07-11  0:00         ` Robert A Duff
1996-07-11  0:00           ` Robert Dewar
1996-07-12  0:00             ` David Morton
1996-07-12  0:00               ` Robert Dewar
1996-07-16  0:00                 ` Michael Paus
1996-07-03  0:00 ` Mike Card (x3022)
1996-07-04  0:00 ` Jon S Anthony
1996-07-03  0:00   ` Robert Dewar
1996-07-03  0:00   ` Robert Dewar
1996-07-04  0:00   ` Robert A Duff
1996-07-05  0:00 ` Jon S Anthony
1996-07-06  0:00   ` Robert Dewar
1996-07-05  0:00 ` Jon S Anthony
1996-07-09  0:00 ` Jon S Anthony
1996-07-09  0:00   ` Robert Dewar
1996-07-12  0:00   ` Jon S Anthony
1996-07-21  0:00     ` Robert A Duff
1996-07-09  0:00 ` Jon S Anthony
1996-07-11  0:00 ` Jon S Anthony
1996-07-11  0:00   ` Robert A Duff
1996-07-12  0:00   ` Robert Dewar
1996-07-14  0:00 ` Norman H. Cohen
1996-07-15  0:00   ` Robert Dewar
1996-07-15  0:00 ` Jon S Anthony
1996-07-15  0:00   ` Robert Dewar
1996-07-16  0:00 ` Jon S Anthony

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