comp.lang.ada
 help / color / mirror / Atom feed
From: rriehle@itu.edu
Subject: Re: Can .ads be compiled alone?
Date: Sun, 16 Nov 2014 16:07:05 -0800 (PST)
Date: 2014-11-16T16:07:05-08:00	[thread overview]
Message-ID: <558e3ad3-8d64-46f4-a0ca-6df137b256ec@googlegroups.com> (raw)
In-Reply-To: <wccwq6w1dfq.fsf@shell01.TheWorld.com>

On Saturday, November 15, 2014 11:16:50 AM UTC-8, Robert A Duff wrote:
> rriehle@itu.edu writes:
> 
> > The code you just posted is directly copied from Ada Distilled.  The
> > specification will compile just fine since it is only a specification.
> > You must compile the specification before the body.  They should be
> > compiled separately.
> 
> That depends on the compiler.  Some Ada compilers work the way you
> describe above.  GNAT does not.
> 
> Not that in GNAT, there are no requirements on compilation order.
> 
> - Bob

The code, in the example, which I originally published in my book, Ada Distilled, was compiled with GNAT.   I first compiled the specification, and then the body.   It has always been my practice to create the specification before completing the code for the body.   In fact, in the Machinery example, which is used only for pedagogic purposes, was written with the subprograms in the body stubbed-out with simply Put statements, the tested with a separate subprogram, and them finished with the completed code in the body.  I did this with all the coded examples in Ada Distilled so I could be sure that every bit of sample code would actually execute if entered exactly as I showed it in the book.   

In a future edition of Ada Distilled, in which I am collaborating with Ed Colbert, we will add examples of pre- and post-conditions, as well as other newer features of Ada 2012.


  parent reply	other threads:[~2014-11-17  0:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  5:21 Can .ads be compiled alone? moixa
2014-11-07  6:09 ` Jeffrey Carter
2014-11-07 17:26   ` Robert A Duff
2014-11-07 17:41     ` Jeffrey Carter
2014-11-07  6:20 ` J-P. Rosen
2014-11-07  7:48 ` Chris Moore
2014-11-07 14:54   ` Tero Koskinen
2014-11-07 15:49     ` Björn Lundin
2014-11-07 16:29       ` G.B.
2014-11-08 13:01         ` moixa
2014-11-08 14:55           ` G.B.
2014-11-07 16:29       ` G.B.
2014-11-07 16:44     ` Adam Beneschan
2014-11-07 17:14   ` Shark8
2014-11-08 21:31     ` Chris Moore
2014-11-07 16:50 ` Adam Beneschan
2014-11-07 17:14   ` Robert A Duff
2014-11-08  2:01     ` Randy Brukardt
2014-11-15 12:54 ` rriehle
2014-11-15 19:17   ` Robert A Duff
2014-11-15 19:19     ` Robert A Duff
2014-11-17 15:52       ` Adam Beneschan
2014-11-17  0:07     ` rriehle [this message]
2014-11-17  6:50       ` Simon Wright
2014-11-24  3:16     ` rriehle
2014-11-24  6:34       ` Jeffrey Carter
replies disabled

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