comp.lang.ada
 help / color / mirror / Atom feed
* GNAT GPL is proving...educational
@ 2013-07-22  1:28 Alan Jump
  2013-07-22  3:26 ` Jeffrey Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Alan Jump @ 2013-07-22  1:28 UTC (permalink / raw)


A neophyte commentary follows...pardon me whilst I pull on my flame-retardant underwear. :-)

Learning Ada has its pitfalls and pratfalls, just as learning any other language. I've just run across a couple of them, thanks to the example code provided with Barnes' "Programming in Ada 2005". First off is an apparent change in coding style required by GNAT...specifically, only one full stop is allowed in a given filename or package/function/procedure name. So, rather than being able to say

package Stacks.Vector is

one must use

package Stacks_Vector is

and then save the file as Stacks_Vector.ads.

The other unexpected (but, on reflection, totally logical) curveball is that GNAT, and Ada in general, really doesn't like monolithic program files...I would have simply blamed GNAT, but the same problem occurred when trying to load the example source code through AdaGIDE, so it's clearly a shift in thinking now required by Ada. Package specifications get their own .ads file, everything else goes in .adb files.

Coming from a background that involved FORTRAN and some basic-level Java6, there's a definite learning curve. But I've no doubt the results will justify the efforts.

(Now, do I dare take that flame-retardant underwear off yet? It's itchy.)

- -
73 de N5ILN
Alan

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

* Re: GNAT GPL is proving...educational
  2013-07-22  1:28 GNAT GPL is proving...educational Alan Jump
@ 2013-07-22  3:26 ` Jeffrey Carter
  2013-07-22  3:50   ` Alan Jump
  2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
  2013-07-22  7:18 ` Niklas Holsti
  2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
  2 siblings, 2 replies; 30+ messages in thread
From: Jeffrey Carter @ 2013-07-22  3:26 UTC (permalink / raw)


On 07/21/2013 06:28 PM, Alan Jump wrote:
>
> package Stacks.Vector is
>
> one must use
>
> package Stacks_Vector is
>
> and then save the file as Stacks_Vector.ads.

Stacks.Vector is a child package; its parent is package Stacks. Package Stacks 
must exist to have child packages.

GNAT's default naming rules expect the specification of package Stacks_Vector to 
be in a file named stacks_vector.ads (all lower case) with its body in 
stacks_vector.adb. (Package Stacks.Vector would be in a files named 
stacks-vector.ad[sb].) Ada has nothing to say about source file names. Many 
compilers will accept any file names you care to use.

GNAT also requires one compilation unit per source file, but this again is not 
something defined by the language, and many compilers will accept files 
containing multiple compilation units. Many experienced Ada software engineers 
find having a single compilation unit per file a good idea.

-- 
Jeff Carter
"If a sperm is wasted, God gets quite irate."
Monty Python's the Meaning of Life
56


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

* Re: GNAT GPL is proving...educational
  2013-07-22  3:26 ` Jeffrey Carter
@ 2013-07-22  3:50   ` Alan Jump
  2013-07-22  5:11     ` Jeffrey Carter
                       ` (2 more replies)
  2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
  1 sibling, 3 replies; 30+ messages in thread
From: Alan Jump @ 2013-07-22  3:50 UTC (permalink / raw)


On Sunday, July 21, 2013 8:26:10 PM UTC-7, Jeffrey Carter wrote:
 
> > package Stacks.Vector is
 
> >
 
> > one must use
 
> > package Stacks_Vector is
 
> > and then save the file as Stacks_Vector.ads.

> Stacks.Vector is a child package; its parent is package Stacks. Package Stacks 
> 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 changed the filename and refactored the references from Stacks.Vector to Stacks_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_Vector to 
> be in a file named stacks_vector.ads (all lower case) with its body in 
> stacks_vector.adb. (Package Stacks.Vector would be in a files named 
> stacks-vector.ad[sb].) Ada has nothing to say about source file names. Many 
> compilers will accept any file names you care to use.
 

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 write. I wish Java had been that strict when I was learning that language; it 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, and that's a Very Good Thing(tm). 

 
> GNAT also requires one compilation unit per source file, but this again is not 
> something defined by the language, and many compilers will accept files 
> containing multiple compilation units. Many experienced Ada software engineers 
> find having a single compilation unit per file a good idea.

Here's another neophyte question, then...are specs and bodies considered separate compilation units? GNAT also complained when I tried to write a specification 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, keeping them in separate files and generating a body stub from the specification does a lot in keeping me honest.

- -
73 de N5ILN
Alan

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

* Re: GNAT GPL is proving...educational
  2013-07-22  3:50   ` Alan Jump
@ 2013-07-22  5:11     ` Jeffrey Carter
  2013-07-22 22:19       ` Shark8
  2013-07-22  5:28     ` Bill Findlay
  2013-08-01 15:07     ` Stephen Leake
  2 siblings, 1 reply; 30+ messages in thread
From: Jeffrey Carter @ 2013-07-22  5:11 UTC (permalink / raw)


On 07/21/2013 08:50 PM, Alan Jump wrote:
>
> 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
> changed the filename and refactored the references from Stacks.Vector to
> Stacks_Vector and the problem went away. And yes, the Stacks interface
> package already existed.)

I would have to see what you have for each package, and the names of the files 
you have them in, to be sure what's going on. but I can assure you that GNAT 
will accept child packages; I've used them many times. One thing to note, given 
your mention of "stacks.vector.ads" is that the file name replaces dots in the 
Ada name with hypens; package Stacks.Vector should be in file "stacks-vector.ads".

> Here's another neophyte question, then...are specs and bodies considered
> separate compilation units? GNAT also complained when I tried to write a
> specification 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,
> keeping them in separate files and generating a body stub from the
> specification does a lot in keeping me honest.

Yes, package specifications and bodies are separate compilation units.

-- 
Jeff Carter
"If a sperm is wasted, God gets quite irate."
Monty Python's the Meaning of Life
56


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

* Re: GNAT GPL is proving...educational
  2013-07-22  3:50   ` Alan Jump
  2013-07-22  5:11     ` Jeffrey Carter
@ 2013-07-22  5:28     ` Bill Findlay
  2013-07-22  8:49       ` Georg Bauhaus
  2013-08-01 15:07     ` Stephen Leake
  2 siblings, 1 reply; 30+ messages in thread
From: Bill Findlay @ 2013-07-22  5:28 UTC (permalink / raw)


On 22/07/2013 04:50, in article
be5b1878-f8f0-4448-adeb-9613f4c61b97@googlegroups.com, "Alan Jump"
<alan.jump@gmail.com> wrote:

> On Sunday, July 21, 2013 8:26:10 PM UTC-7, Jeffrey Carter wrote:
>> Stacks.Vector is a child package; its parent is package Stacks. Package
>> Stacks must exist to have child packages.
> 
> Tried it. Didn't work. GNAT responded "stacks.vector.ads language unknown".

Belive it or not there is superb documentation that explains all this, but
it is the very well kept secret of the Ada cabal.

Oh, OK.  Don't tell anyone else, but I'll spill the beans just for you: the
GNAT GPL User¹s Guide and the GNAT Reference Manual are both available at
the extortionate price of $0.00 at a website near you (and everyone else).

That's my cabal membership gone up in flames!

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;




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

* Re: GNAT GPL is proving...educational
  2013-07-22  1:28 GNAT GPL is proving...educational Alan Jump
  2013-07-22  3:26 ` Jeffrey Carter
@ 2013-07-22  7:18 ` Niklas Holsti
  2013-07-22  8:52   ` Simon Wright
  2013-07-31  2:02   ` David Thompson
  2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
  2 siblings, 2 replies; 30+ messages in thread
From: Niklas Holsti @ 2013-07-22  7:18 UTC (permalink / raw)


On 13-07-22 04:28 , Alan Jump wrote:
> A neophyte commentary follows...pardon me whilst I
> pull on my flame-retardant underwear. :-)

Such special foundation garments are rarely needed in comp.lang.ada, I
am glad to say.

> Learning Ada has its pitfalls and pratfalls, just as learning
> any other language. I've just run across a couple of them,
> thanks to the example code provided with Barnes' "Programming
> in Ada 2005". First off is an apparent change in coding style
> required by GNAT...

GNAT does not require changes in coding style, but the default GNAT
naming convention for files replaces "." in the Ada name with "-" in the
file name. The default names can be overridden by using a GNAT project file.

> package Stacks.Vector is

As others have said, the GNAT default file name for this packagte
declaration is

   stacks-vector.ads

For the Ada unit A.B.C, the default file name is a-b-c, followed by
".ads" for the declaration part and ".adb" for the body part. See
http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/File-Naming-Rules.html#File-Naming-Rules.

If you are interested in the background for why GNAT has a default file
naming convention, and insists on a single unit per file, see
http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/The-GNAT-Compilation-Model.html#The-GNAT-Compilation-Model.

> The other unexpected (but, on reflection, totally logical)
> curveball is that GNAT, and Ada in general, really doesn't like
> monolithic program files...

Not true for Ada in general, but true for GNAT and for most Ada
programmers (and also C programmers, who almost without exception have
separate .h and .c files).

> I would have simply blamed GNAT, but the same problem occurred
> when trying to load the example source code through AdaGIDE, so
> it's clearly a shift in thinking now required by Ada.

Not required by Ada, but by GNAT and perhaps by AdaGIDE (I don't know
enough about the latter to say for sure). But Ada does emphasize the
separation of specification (declaration) and implementation (body),
making it natural to keep them in separate files.

Note that AdaCore provides the "gnatchop" tool to split multi-unit
source files into single-unit files following the GNAT default naming
rules. Basically, you say

   gnatchop multi-unit-file-name

and the resulting single-unit files appear in the working directory.

> Package specifications get their own .ads file, everything else
> goes in .adb files.

Just so.

> Coming from a background that involved FORTRAN and some basic-level
> Java6, there's a definite learning curve.

Understandable. Original Fortran had no formal separation of
specification and implementation, and Java unfortunately puts both in
the same file, as I understand it.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .

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

* Re: GNAT GPL is proving...educational
  2013-07-22  5:28     ` Bill Findlay
@ 2013-07-22  8:49       ` Georg Bauhaus
  2013-07-22  9:04         ` Bill Findlay
  0 siblings, 1 reply; 30+ messages in thread
From: Georg Bauhaus @ 2013-07-22  8:49 UTC (permalink / raw)


On 22.07.13 07:28, Bill Findlay wrote:

> the
> GNAT GPL User¹s Guide and the GNAT Reference Manual are both available at
> the extortionate price of $0.00 at a website near you (and everyone else).

Make people waste money on internet traffic!
The right documentation is *part*  *of* *the* *distribution*.

Now that form of availability is, indeed, becoming unusual, and
therefore secret these days.


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

* Re: GNAT GPL is proving...educational
  2013-07-22  7:18 ` Niklas Holsti
@ 2013-07-22  8:52   ` Simon Wright
  2013-07-31  2:02   ` David Thompson
  1 sibling, 0 replies; 30+ messages in thread
From: Simon Wright @ 2013-07-22  8:52 UTC (permalink / raw)


Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> Note that AdaCore provides the "gnatchop" tool to split multi-unit
> source files into single-unit files following the GNAT default naming
> rules. Basically, you say
>
>    gnatchop multi-unit-file-name
>
> and the resulting single-unit files appear in the working directory.

Also, gnatchop[1] has the flags

  -r       generate Source_Reference pragmas referencing original source file

and

  -w       overwrite existing filenames

which can be used to maintain a multiple-unit source file. I can't see
how to make GPS support this, and I can't find whether AdaGIDE will
because it's Windows-only; for Emacs, I wrote a minor mode[2] which runs
gnatchop -w -r whenever a gnatchop-mode buffer is saved.

[1] http://docs.adacore.com/gnat-unw-docs/html/gnat_ugn_9.html#SEC108
[2] https://sourceforge.net/u/simonjwright/gnatchop/wiki/Home/

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

* Re: GNAT GPL is proving...educational
  2013-07-22  8:49       ` Georg Bauhaus
@ 2013-07-22  9:04         ` Bill Findlay
  0 siblings, 0 replies; 30+ messages in thread
From: Bill Findlay @ 2013-07-22  9:04 UTC (permalink / raw)


On 22/07/2013 09:49, in article
51ecf208$0$6578$9b4e6d93@newsspool3.arcor-online.net, "Georg Bauhaus"
<rm.dash-bauhaus@futureapps.de> wrote:

> On 22.07.13 07:28, Bill Findlay wrote:
> 
>> the
>> GNAT GPL User¹s Guide and the GNAT Reference Manual are both available at
>> the extortionate price of $0.00 at a website near you (and everyone else).
> 
> Make people waste money on internet traffic!
> The right documentation is *part*  *of* *the* *distribution*.

But, but, but .... That is on the interwebs at the aforementioned price.
8-)
-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;


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

* Re: GNAT GPL is proving...educational
  2013-07-22  1:28 GNAT GPL is proving...educational Alan Jump
  2013-07-22  3:26 ` Jeffrey Carter
  2013-07-22  7:18 ` Niklas Holsti
@ 2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
  2013-07-22 19:04   ` Alan Jump
  2 siblings, 1 reply; 30+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-22 18:28 UTC (permalink / raw)


Le Mon, 22 Jul 2013 03:28:32 +0200, Alan Jump <alan.jump@gmail.com> a  
écrit:

> The other unexpected (but, on reflection, totally logical) curveball is  
> that GNAT, and Ada in general, really doesn't like monolithic program  
> files...I would have simply blamed GNAT, but the same problem occurred  
> when trying to load the example source code through AdaGIDE, so it's  
> clearly a shift in thinking now required by Ada. Package specifications  
> get their own .ads file, everything else goes in .adb files.

That's a common complain from people coming from Pascal. But that's not  
Ada, that's GNAT. Nothing in the RM requires the specification and the  
body belongs to separate files (it does neither requires Ada sources to be  
stored in files, by the way, it just requires Ada source to be text made  
of characters).

About the other issue with files names, Niklas Holsti already gave you the  
answer. Of cause you can use child packages with GNAT :-p


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: GNAT GPL is proving...educational
  2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
@ 2013-07-22 19:04   ` Alan Jump
  2013-07-22 19:49     ` Ludovic Brenta
                       ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Alan Jump @ 2013-07-22 19:04 UTC (permalink / raw)


On Monday, July 22, 2013 11:28:45 AM UTC-7, Hibou57 (Yannick Duchêne) wrote:
> That's a common complain from people coming from Pascal. But that's not  
> Ada, that's GNAT. Nothing in the RM requires the specification and the  
> body belongs to separate files (it does neither requires Ada sources to be  
> stored in files, by the way, it just requires Ada source to be text made  
> of characters).
> 
> About the other issue with files names, Niklas Holsti already gave you the  
> answer. Of cause you can use child packages with GNAT :-p

Got it. When I get home from my "real" job and have the opportunity, I'll make the indicated changes and rebuild. It's all educational at this point, so every error message is a teachable moment, yes?

I still find myself wishing for a better "introductory" text than Barnes; I'm a neophyte coder, not a language lawyer. And it's already been said elsewhere (several times!) that the LRM is written as a cure for insomnia. I'd be happy finding a good lower-division text that explains more of the "how" and less of the "why". I have a copy of "Rendezvous with Ada 95" on the way, and somewhere on my backup drive I have the Ada95 Wikibook. I may even, somewhere, have the old Ada Tutor zip file stashed away, but that will take some digging in dark corners to locate. In the meantime, though, I'll keep feeding code into GNAT and working on figuring out the error messages that code throws. :-)

"No learning, no knowledge, is ever wasted." -- unknown


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

* Re: GNAT GPL is proving...educational
  2013-07-22 19:04   ` Alan Jump
@ 2013-07-22 19:49     ` Ludovic Brenta
  2013-07-22 19:51     ` Simon Wright
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 30+ messages in thread
From: Ludovic Brenta @ 2013-07-22 19:49 UTC (permalink / raw)


Alan Jump writes on comp.lang.ada:
> On Monday, July 22, 2013 11:28:45 AM UTC-7, Hibou57 (Yannick Duchêne) wrote:
>> That's a common complain from people coming from Pascal. But that's not  
>> Ada, that's GNAT. Nothing in the RM requires the specification and the  
>> body belongs to separate files (it does neither requires Ada sources to be  
>> stored in files, by the way, it just requires Ada source to be text made  
>> of characters).
>> 
>> About the other issue with files names, Niklas Holsti already gave you the  
>> answer. Of cause you can use child packages with GNAT :-p
>
> Got it. When I get home from my "real" job and have the opportunity,
> I'll make the indicated changes and rebuild. It's all educational at
> this point, so every error message is a teachable moment, yes?
>
> I still find myself wishing for a better "introductory" text than
> Barnes; I'm a neophyte coder, not a language lawyer.

This may be what you need:

http://archive.adaic.com/docs/craft/craft.html

And more generally:

http://www.adaic.org/learn/materials/

The above two are about the *language* but you also need an introduction
to the particular *compiler*, this is part of the compiler distribution
you received.  If you use GPS, go to the Help menu and browse the GNAT
User's Guide.

HTH

-- 
Ludovic Brenta.

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

* Re: GNAT GPL is proving...educational
  2013-07-22 19:04   ` Alan Jump
  2013-07-22 19:49     ` Ludovic Brenta
@ 2013-07-22 19:51     ` Simon Wright
  2013-07-22 20:12     ` Jeffrey Carter
  2013-07-22 23:34     ` Adam Beneschan
  3 siblings, 0 replies; 30+ messages in thread
From: Simon Wright @ 2013-07-22 19:51 UTC (permalink / raw)


Alan Jump <alan.jump@gmail.com> writes:

> I still find myself wishing for a better "introductory" text than
> Barnes

My favourite was the John English book, now available (but with some
broken links) at http://archive.adaic.com/docs/craft/craft.html.

See also http://www.adaic.org/learn/materials/ (AdaTutor is there, too).


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

* Re: GNAT GPL is proving...educational
  2013-07-22 19:04   ` Alan Jump
  2013-07-22 19:49     ` Ludovic Brenta
  2013-07-22 19:51     ` Simon Wright
@ 2013-07-22 20:12     ` Jeffrey Carter
  2013-07-22 23:34     ` Adam Beneschan
  3 siblings, 0 replies; 30+ messages in thread
From: Jeffrey Carter @ 2013-07-22 20:12 UTC (permalink / raw)


On 07/22/2013 12:04 PM, Alan Jump wrote:
>
> I still find myself wishing for a better "introductory" text than Barnes; I'm
> a neophyte coder, not a language lawyer. And it's already been said elsewhere
> (several times!) that the LRM is written as a cure for insomnia. I'd be happy
> finding a good lower-division text that explains more of the "how" and less
> of the "why". I have a copy of "Rendezvous with Ada 95" on the way, and
> somewhere on my backup drive I have the Ada95 Wikibook. I may even,
> somewhere, have the old Ada Tutor zip file stashed away, but that will take
> some digging in dark corners to locate. In the meantime, though, I'll keep
> feeding code into GNAT and working on figuring out the error messages that
> code throws. :-)

For someone already familiar with programming, I'd recommend "Ada Distilled":

http://www.adaic.org/wp-content/uploads/2010/05/Ada-Distilled-24-January-2011-Ada-2005-Version.pdf

However, this won't help you with a specific compiler, which seems to be the 
source of your confusion. For that you'll have to refer to the top-secret GNAT 
documentation.

-- 
Jeff Carter
"Mr. President, we must not allow a mine-shaft gap!"
Dr. Strangelove
33


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

* Re: GNAT GPL is proving...educational
  2013-07-22  5:11     ` Jeffrey Carter
@ 2013-07-22 22:19       ` Shark8
  0 siblings, 0 replies; 30+ messages in thread
From: Shark8 @ 2013-07-22 22:19 UTC (permalink / raw)


On Sunday, July 21, 2013 11:11:32 PM UTC-6, Jeffrey Carter wrote:
> 
> your mention of "stacks.vector.ads" is that the file name replaces dots in the 
> Ada name with hypens; package Stacks.Vector should be in file "stacks-vector.ads".

There's the "dot replacement character" which can be specified easily in GPS (or via GPR-file); I particularly like using '.'  in conjunction with the MixedCase option for file-name casing (1) for consistency's sake, and (2) to screw with people who use case-sensitive FSes.


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

* Re: GNAT GPL is proving...educational
  2013-07-22 19:04   ` Alan Jump
                       ` (2 preceding siblings ...)
  2013-07-22 20:12     ` Jeffrey Carter
@ 2013-07-22 23:34     ` Adam Beneschan
  2013-07-23  3:46       ` Shark8
  2013-07-27  3:17       ` Randy Brukardt
  3 siblings, 2 replies; 30+ messages in thread
From: Adam Beneschan @ 2013-07-22 23:34 UTC (permalink / raw)


On Monday, July 22, 2013 12:04:00 PM UTC-7, Alan Jump wrote:

> I still find myself wishing for a better "introductory" text than Barnes; I'm a neophyte coder, not a language lawyer. And it's already been said elsewhere (several times!) that the LRM is written as a cure for insomnia.

I don't recommend using LRM 3.10.2 for that purpose since it will lead to nightmares.  :) :)

                            -- Adam


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

* Re: GNAT GPL is proving...educational
  2013-07-22 23:34     ` Adam Beneschan
@ 2013-07-23  3:46       ` Shark8
  2013-07-23 17:46         ` Yannick Duchêne (Hibou57)
  2013-07-27  3:17       ` Randy Brukardt
  1 sibling, 1 reply; 30+ messages in thread
From: Shark8 @ 2013-07-23  3:46 UTC (permalink / raw)


On Monday, July 22, 2013 5:34:09 PM UTC-6, Adam Beneschan wrote:
> 
> I don't recommend using LRM 3.10.2 for that purpose since it will lead to nightmares.  :) :)

I prefer of thinking of it as the crushing of all the hopes and dreams of amateur compiler-writers who might be interested in doing an Ada. ;)

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

* Re: GNAT GPL is proving...educational
  2013-07-23  3:46       ` Shark8
@ 2013-07-23 17:46         ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 30+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-23 17:46 UTC (permalink / raw)


Le Tue, 23 Jul 2013 05:46:16 +0200, Shark8 <onewingedshark@gmail.com> a  
écrit:

> On Monday, July 22, 2013 5:34:09 PM UTC-6, Adam Beneschan wrote:
>>
>> I don't recommend using LRM 3.10.2 for that purpose since it will lead  
>> to nightmares.  :) :)
>
> I prefer of thinking of it as the crushing of all the hopes and dreams  
> of amateur compiler-writers who might be interested in doing an Ada. ;)

Funny you believe this. On my own side, I always believed the most hard  
part is tasking and distributed system related annexe; may be unreal “real  
numbers” too, but I may be biased on this, as I don't enjoy floating  
points.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: GNAT GPL is proving...educational
  2013-07-22  3:26 ` Jeffrey Carter
  2013-07-22  3:50   ` Alan Jump
@ 2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
  2013-07-25 20:25     ` J-P. Rosen
  1 sibling, 1 reply; 30+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-25  5:41 UTC (permalink / raw)


Le Mon, 22 Jul 2013 05:26:10 +0200, Jeffrey Carter  
<spam.jrcarter.not@spam.not.acm.org> a écrit:
> GNAT also requires one compilation unit per source file, but this again  
> is not something defined by the language, and many compilers will accept  
> files containing multiple compilation units. Many experienced Ada  
> software engineers find having a single compilation unit per file a good  
> idea.

Would be nice to even go further, with separate package's private part.


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: GNAT GPL is proving...educational
  2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
@ 2013-07-25 20:25     ` J-P. Rosen
  2013-07-25 23:07       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 30+ messages in thread
From: J-P. Rosen @ 2013-07-25 20:25 UTC (permalink / raw)


Le 25/07/2013 07:41, Yannick Duchêne (Hibou57) a écrit :
> Le Mon, 22 Jul 2013 05:26:10 +0200, Jeffrey Carter
> <spam.jrcarter.not@spam.not.acm.org> a écrit:
>> GNAT also requires one compilation unit per source file, but this
>> again is not something defined by the language, and many compilers
>> will accept files containing multiple compilation units. Many
>> experienced Ada software engineers find having a single compilation
>> unit per file a good idea.
> 
> Would be nice to even go further, with separate package's private part.
> 
This was considered for Ada2012 - another of these nice little features
that end up opening truck-loads of worms...

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

* Re: GNAT GPL is proving...educational
  2013-07-25 20:25     ` J-P. Rosen
@ 2013-07-25 23:07       ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 30+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-25 23:07 UTC (permalink / raw)


Le Thu, 25 Jul 2013 22:25:35 +0200, J-P. Rosen <rosen@adalog.fr> a écrit:

> Le 25/07/2013 07:41, Yannick Duchêne (Hibou57) a écrit :
>> Le Mon, 22 Jul 2013 05:26:10 +0200, Jeffrey Carter
>> <spam.jrcarter.not@spam.not.acm.org> a écrit:
>>> GNAT also requires one compilation unit per source file, but this
>>> again is not something defined by the language, and many compilers
>>> will accept files containing multiple compilation units. Many
>>> experienced Ada software engineers find having a single compilation
>>> unit per file a good idea.
>>
>> Would be nice to even go further, with separate package's private part.
>>
> This was considered for Ada2012 - another of these nice little features
> that end up opening truck-loads of worms...

This was discussed in an AI?


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: GNAT GPL is proving...educational
  2013-07-22 23:34     ` Adam Beneschan
  2013-07-23  3:46       ` Shark8
@ 2013-07-27  3:17       ` Randy Brukardt
  2013-07-29 17:21         ` Alan Jump
  1 sibling, 1 reply; 30+ messages in thread
From: Randy Brukardt @ 2013-07-27  3:17 UTC (permalink / raw)


"Adam Beneschan" <adambeneschan@aol.com> wrote in message 
news:3ebb953d-070c-46a6-99d1-611c5a79f72f@googlegroups.com...
>> On Monday, July 22, 2013 12:04:00 PM UTC-7, Alan Jump wrote:
>>
>>> I still find myself wishing for a better "introductory" text than 
>>> Barnes; I'm a neophyte coder,
>>> not a language lawyer. And it's already been said elsewhere (several 
>>> times!) that the LRM
>>> is written as a cure for insomnia.
>>
>> I don't recommend using LRM 3.10.2 for that purpose since it will lead to 
>> nightmares.  :) :)

Only if the reader understands enough of it to get in trouble. (Like us.) 
For a neophyte coder, it might as well be written in ancient Latin. :-)

It's definitely not for nothing that 3.10.2 has the (unofficial) name "The 
Heart of Darkness". AARM 3.10.2(3.b/3) describes this as " Woe unto all who 
enter here (well, at least unto anyone that needs to understand any of these 
rules)."

                                              Randy.

P.S. I was asked by the ARG to put that note into the AARM; it wasn't my 
idea and perhaps it would have been more entertaining if it had been mine. 
(Or maybe much less entertaining. :-)


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

* Re: GNAT GPL is proving...educational
  2013-07-27  3:17       ` Randy Brukardt
@ 2013-07-29 17:21         ` Alan Jump
  2013-07-29 20:57           ` Shark8
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Jump @ 2013-07-29 17:21 UTC (permalink / raw)


On Friday, July 26, 2013 8:17:03 PM UTC-7, Randy Brukardt wrote:
> 
> >> I don't recommend using LRM 3.10.2 for that purpose since it will lead to 
> 
> >> nightmares.  :) :)
> 
> 
> 
> Only if the reader understands enough of it to get in trouble. (Like us.) 
> 
> For a neophyte coder, it might as well be written in ancient Latin. :-)
> 
> 
> 
> It's definitely not for nothing that 3.10.2 has the (unofficial) name "The 
> 
> Heart of Darkness". AARM 3.10.2(3.b/3) describes this as " Woe unto all who 
> 
> enter here (well, at least unto anyone that needs to understand any of these 
> 
> rules)."
> 
> 
> 
>                                               Randy.
> 
> 
> 
> P.S. I was asked by the ARG to put that note into the AARM; it wasn't my 
> 
> idea and perhaps it would have been more entertaining if it had been mine. 
> 
> (Or maybe much less entertaining. :-)

I actually got my hands on a reference that does a good job of translating 3.10.2 into human-readable form: Divid Naiditch, "Rendezvous with Ada 95". Although I probably should be worried that the descriptive section of that tome is in Chapter 11. (The joke will probably be meaningless to anyone outside the US.)

 - -
73 de N5ILN
Alan

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

* Re: GNAT GPL is proving...educational
  2013-07-29 17:21         ` Alan Jump
@ 2013-07-29 20:57           ` Shark8
  2013-07-29 21:30             ` Adam Beneschan
  0 siblings, 1 reply; 30+ messages in thread
From: Shark8 @ 2013-07-29 20:57 UTC (permalink / raw)


On Monday, July 29, 2013 11:21:22 AM UTC-6, Alan Jump wrote:
> 
> Although I probably should be worried that the descriptive section of that tome is in Chapter 11.

Bankruptcy joke; it cold only be better if the publisher was based in Detroit.

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

* Re: GNAT GPL is proving...educational
  2013-07-29 20:57           ` Shark8
@ 2013-07-29 21:30             ` Adam Beneschan
  2013-07-29 21:44               ` Alan Jump
  0 siblings, 1 reply; 30+ messages in thread
From: Adam Beneschan @ 2013-07-29 21:30 UTC (permalink / raw)


On Monday, July 29, 2013 1:57:40 PM UTC-7, Shark8 wrote:
> On Monday, July 29, 2013 11:21:22 AM UTC-6, Alan Jump wrote:
> 
> > 
> 
> > Although I probably should be worried that the descriptive section of that tome is in Chapter 11.
> 
> Bankruptcy joke; it cold only be better if the publisher was based in Detroit.

Yup :) :)  Except that I think Detroit is filing under Chapter 9.  So what's in Chapter 9 of Naiditch's book?

                            -- Adam

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

* Re: GNAT GPL is proving...educational
  2013-07-29 21:30             ` Adam Beneschan
@ 2013-07-29 21:44               ` Alan Jump
  2013-07-29 22:36                 ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Jump @ 2013-07-29 21:44 UTC (permalink / raw)


On Monday, July 29, 2013 2:30:20 PM UTC-7, Adam Beneschan wrote:
> On Monday, July 29, 2013 1:57:40 PM UTC-7, Shark8 wrote:
> 
> > On Monday, July 29, 2013 11:21:22 AM UTC-6, Alan Jump wrote:
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Although I probably should be worried that the descriptive section of that tome is in Chapter 11.
> 
> > 
> 
> > Bankruptcy joke; it cold only be better if the publisher was based in Detroit.
> 
> 
> 
> Yup :) :)  Except that I think Detroit is filing under Chapter 9.  So what's in Chapter 9 of Naiditch's book?
> 
> 
> 
>                             -- Adam

"Compilation units"...something GNAT users don't seem to have to worry much about. After reading the User Manual, anyway. *koff koff*

 - -
73 de N5ILN
Alan


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

* Re: GNAT GPL is proving...educational
  2013-07-29 21:44               ` Alan Jump
@ 2013-07-29 22:36                 ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 30+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-29 22:36 UTC (permalink / raw)


Le Mon, 29 Jul 2013 23:44:03 +0200, Alan Jump <alan.jump@gmail.com> a  
écrit:
> "Compilation units"...something GNAT users don't seem to have to worry  
> much about. After reading the User Manual, anyway. *koff koff*
>
>  - -
> 73 de N5ILN
> Alan

Why? What did you mean?

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: GNAT GPL is proving...educational
  2013-07-22  7:18 ` Niklas Holsti
  2013-07-22  8:52   ` Simon Wright
@ 2013-07-31  2:02   ` David Thompson
  1 sibling, 0 replies; 30+ messages in thread
From: David Thompson @ 2013-07-31  2:02 UTC (permalink / raw)


<OT>
On Mon, 22 Jul 2013 10:18:21 +0300, Niklas Holsti
<niklas.holsti@tidorum.invalid> wrote:

> > Coming from a background that involved FORTRAN and some basic-level
> > Java6, there's a definite learning curve.
> 
> Understandable. Original Fortran had no formal separation of
> specification and implementation, and Java unfortunately puts both in
> the same file, as I understand it.

Fortran mostly still doesn't. 

Early Fortran requires you to declare the return type of a used
function iff it differs from that determined by the implicit rules 
(by default first char of name I-M is integer and anything else is
single-precision real); in some cases you must declare that a used
function or subroutine (=procedure) is a subprogram as opposed to a
variable but usually that's implicit; and there is no way to declare
the types of its formals (which Fortran calls dummy arguments and uses
the term parameter for something different).

Fortran>=90 adds the idea of an 'explicit interface' required if a
function return type or subprogram argument type uses any new F>=90
feature, and allowed for 'legacy' ones. But this terminology can be
misleading; in most cases you DON'T write an explicit interface. Any
subprogram implemented in a 'module' (similar to an Ada package), or
'contained' (nested) within another subprogram (allowed to one level
only), automatically gets an explicit interface which you MUST NOT
write. For the former you must have previously compiled the referenced
module and the compiler gets the spec from that. Only for an
'external' subprogram can you write an 'interface block' which spells
out the spec.

Java similarly but more consistently ALWAYS uses the implementation as
the specification -- not just the same file but the exact same tokens.
When you compile several classes together the compiler parses all of
them and extracts their specs. If you compile separately, the
'outside' classes you use must have been previously compiled, and the
compiler gets specs from their .class files, either as separate files
or in a 'jar' which is really just a ZIP; this includes the Java
standard library classes in several JRE-supplied jars.

Yes, both of these can produce makefile hell even worse than C.
Although for Java if you change (and compile) a referenced class's
spec and fail to recompile the referencers, Java does guarantee to
catch the discrepancy, pretty close to Ada's consistency rule.
Fortran like C and others makes this unbounded error.

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

* Re: GNAT GPL is proving...educational
  2013-07-22  3:50   ` Alan Jump
  2013-07-22  5:11     ` Jeffrey Carter
  2013-07-22  5:28     ` Bill Findlay
@ 2013-08-01 15:07     ` Stephen Leake
  2013-08-01 19:28       ` Alan Jump
  2 siblings, 1 reply; 30+ messages in thread
From: Stephen Leake @ 2013-08-01 15:07 UTC (permalink / raw)


Alan Jump <alan.jump@gmail.com> writes:

> On Sunday, July 21, 2013 8:26:10 PM UTC-7, Jeffrey Carter wrote:
>
>> Stacks.Vector is a child package; its parent is package Stacks. Package Stacks 
>> must exist to have child packages.
>
> Tried it. Didn't work. GNAT responded "stacks.vector.ads language
> unknown". 

Try again, more carefully. The file name should be "stacks-vector.ads".

Slow down, read the manual, be careful. Ada does work, GNAT does work;
there are millions of lines of code out there proving it.

> 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 write. I wish Java had been that strict when I was learning
> that language; it 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, and that's a Very Good Thing(tm).

Except that you seem to have missed that it does support parent and
child packages, which is a very important feature.

>> GNAT also requires one compilation unit per source file, but this again is not 
>> something defined by the language, and many compilers will accept files 
>> containing multiple compilation units. Many experienced Ada software engineers 
>> find having a single compilation unit per file a good idea.
>
> Here's another neophyte question, then...are specs and bodies
> considered separate compilation units? 

Yes.

-- 
-- Stephe

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

* Re: GNAT GPL is proving...educational
  2013-08-01 15:07     ` Stephen Leake
@ 2013-08-01 19:28       ` Alan Jump
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Jump @ 2013-08-01 19:28 UTC (permalink / raw)


Thanks for the input. However, these questions were answered earlier.

 - -
73 de N5ILN
Alan

On Thursday, August 1, 2013 8:07:58 AM UTC-7, Stephen Leake wrote:
> Alan Jump <alan.jump@gmail.com> writes:
> 
> 
> 
> > On Sunday, July 21, 2013 8:26:10 PM UTC-7, Jeffrey Carter wrote:
> 
> >
> 
> >> Stacks.Vector is a child package; its parent is package Stacks. Package Stacks 
> 
> >> must exist to have child packages.
> 
> >
> 
> > Tried it. Didn't work. GNAT responded "stacks.vector.ads language
> 
> > unknown". 
> 
> 
> 
> Try again, more carefully. The file name should be "stacks-vector.ads".
> 
> 
> 
> Slow down, read the manual, be careful. Ada does work, GNAT does work;
> 
> there are millions of lines of code out there proving it.
> 
> 
> 
> > 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 write. I wish Java had been that strict when I was learning
> 
> > that language; it 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, and that's a Very Good Thing(tm).
> 
> 
> 
> Except that you seem to have missed that it does support parent and
> 
> child packages, which is a very important feature.
> 
> 
> 
> >> GNAT also requires one compilation unit per source file, but this again is not 
> 
> >> something defined by the language, and many compilers will accept files 
> 
> >> containing multiple compilation units. Many experienced Ada software engineers 
> 
> >> find having a single compilation unit per file a good idea.
> 
> >
> 
> > Here's another neophyte question, then...are specs and bodies
> 
> > considered separate compilation units? 
> 
> 
> 
> Yes.
> 
> 
> 
> -- 
> 
> -- Stephe

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

end of thread, other threads:[~2013-08-01 19:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22  1:28 GNAT GPL is proving...educational Alan Jump
2013-07-22  3:26 ` Jeffrey Carter
2013-07-22  3:50   ` Alan Jump
2013-07-22  5:11     ` Jeffrey Carter
2013-07-22 22:19       ` Shark8
2013-07-22  5:28     ` Bill Findlay
2013-07-22  8:49       ` Georg Bauhaus
2013-07-22  9:04         ` Bill Findlay
2013-08-01 15:07     ` Stephen Leake
2013-08-01 19:28       ` Alan Jump
2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
2013-07-25 20:25     ` J-P. Rosen
2013-07-25 23:07       ` Yannick Duchêne (Hibou57)
2013-07-22  7:18 ` Niklas Holsti
2013-07-22  8:52   ` Simon Wright
2013-07-31  2:02   ` David Thompson
2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
2013-07-22 19:04   ` Alan Jump
2013-07-22 19:49     ` Ludovic Brenta
2013-07-22 19:51     ` Simon Wright
2013-07-22 20:12     ` Jeffrey Carter
2013-07-22 23:34     ` Adam Beneschan
2013-07-23  3:46       ` Shark8
2013-07-23 17:46         ` Yannick Duchêne (Hibou57)
2013-07-27  3:17       ` Randy Brukardt
2013-07-29 17:21         ` Alan Jump
2013-07-29 20:57           ` Shark8
2013-07-29 21:30             ` Adam Beneschan
2013-07-29 21:44               ` Alan Jump
2013-07-29 22:36                 ` Yannick Duchêne (Hibou57)

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