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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.163.14 with SMTP id y14mr25161411qax.3.1374465037158; Sun, 21 Jul 2013 20:50:37 -0700 (PDT) X-Received: by 10.50.40.104 with SMTP id w8mr2276569igk.1.1374465036928; Sun, 21 Jul 2013 20:50:36 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!f1no359637qae.0!news-out.google.com!dk8ni1116qab.0!nntp.google.com!gh1no29387qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 21 Jul 2013 20:50:36 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=99.43.10.175; posting-account=nD_N8QoAAACgNfe5vMwm0rMAu4pgYumJ NNTP-Posting-Host: 99.43.10.175 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNAT GPL is proving...educational From: Alan Jump Injection-Date: Mon, 22 Jul 2013 03:50:37 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:16458 Date: 2013-07-21T20:50:36-07:00 List-Id: On Sunday, July 21, 2013 8:26:10 PM UTC-7, Jeffrey Carter wrote: =20 > > package Stacks.Vector is =20 > > =20 > > one must use =20 > > package Stacks_Vector is =20 > > and then save the file as Stacks_Vector.ads. > Stacks.Vector is a child package; its parent is package Stacks. Package S= tacks=20 > must exist to have child packages. Tried it. Didn't work. GNAT responded "stacks.vector.ads language unknown".= (Or something like that. I didn't write down the exact error message; I ch= anged the filename and refactored the references from Stacks.Vector to Stac= ks_Vector and the problem went away. And yes, the Stacks interface package = already existed.) > GNAT's default naming rules expect the specification of package Stacks_Ve= ctor to=20 > be in a file named stacks_vector.ads (all lower case) with its body in=20 > stacks_vector.adb. (Package Stacks.Vector would be in a files named=20 > stacks-vector.ad[sb].) Ada has nothing to say about source file names. Ma= ny=20 > compilers will accept any file names you care to use. =20 I don't mind this at all. Especially with the option to generate body stubs= from spec files. It works to make sure the body I write meets the spec I w= rite. I wish Java had been that strict when I was learning that language; i= t would have saved me many hours of debugging, not to mention avoiding more= than a few platefuls of spaghetti code. All I'm pointing out here is that = it's forcing a shift in thinking about how I draft both specs and bodies, a= nd that's a Very Good Thing(tm).=20 =20 > GNAT also requires one compilation unit per source file, but this again i= s not=20 > something defined by the language, and many compilers will accept files= =20 > containing multiple compilation units. Many experienced Ada software engi= neers=20 > find having a single compilation unit per file a good idea. Here's another neophyte question, then...are specs and bodies considered se= parate compilation units? GNAT also complained when I tried to write a spec= ification and body for a package in a single file. This may also have been = me still learning GPS' options, and if they do have to be in separate files= to keep GNAT happy without diving too deeply into options I don't need to = be futzing with as a learner, so much the better. And like I pointed out, k= eeping them in separate files and generating a body stub from the specifica= tion does a lot in keeping me honest. - - 73 de N5ILN Alan