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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.42.70.5 with SMTP id d5mr42478792icj.32.1416182826678; Sun, 16 Nov 2014 16:07:06 -0800 (PST) X-Received: by 10.50.47.45 with SMTP id a13mr229887ign.7.1416182826557; Sun, 16 Nov 2014 16:07:06 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h15no1584434igd.0!news-out.google.com!ks2ni22429igb.0!nntp.google.com!uq10no236138igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 16 Nov 2014 16:07:05 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:9:1100:e95:a998:ef15:f869:8c48; posting-account=XrU4OgoAAADEPkoULFhRQzFYU74OGc9X NNTP-Posting-Host: 2601:9:1100:e95:a998:ef15:f869:8c48 References: <520f8f3d-b345-4ef8-ac41-ead78edde92a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <558e3ad3-8d64-46f4-a0ca-6df137b256ec@googlegroups.com> Subject: Re: Can .ads be compiled alone? From: rriehle@itu.edu Injection-Date: Mon, 17 Nov 2014 00:07:06 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:23438 Date: 2014-11-16T16:07:05-08:00 List-Id: On Saturday, November 15, 2014 11:16:50 AM UTC-8, Robert A Duff wrote: > rriehle@itu.edu writes: >=20 > > 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. >=20 > That depends on the compiler. Some Ada compilers work the way you > describe above. GNAT does not. >=20 > Not that in GNAT, there are no requirements on compilation order. >=20 > - Bob The code, in the example, which I originally published in my book, Ada Dist= illed, was compiled with GNAT. I first compiled the specification, and th= en the body. It has always been my practice to create the specification b= efore completing the code for the body. In fact, in the Machinery example= , which is used only for pedagogic purposes, was written with the subprogra= ms in the body stubbed-out with simply Put statements, the tested with a se= parate 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. =20 In a future edition of Ada Distilled, in which I am collaborating with Ed C= olbert, we will add examples of pre- and post-conditions, as well as other = newer features of Ada 2012.