comp.lang.ada
 help / color / mirror / Atom feed
* How (or Where?) to get started on Ada? (Properly)
@ 2013-09-04  9:14 e.s.harney
  2013-09-04  9:40 ` Gour
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: e.s.harney @ 2013-09-04  9:14 UTC (permalink / raw)


Some general details on my situation (that may be useful or not for the question; feel free to skip down to the "TL;DR" marker if you don't want to read them):

As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). 

Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). 

Looking at the other options available currently, Ada seemed like the best one (still actively maintained; competitive compiler; windows/linux-portability; .. at times I wonder if we'd be seeing thing like Rust or Go if Ada didn't still have its Pascal syntax...)

So here I am, looking into learning Ada.. I have dabbled in it (as well as Turbo Pascal) at various points in time for school/university courses, but those have been very shallow experiences.

TL;DR:
What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run)..

What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.

I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).

Do you have any recommendations for me?

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
@ 2013-09-04  9:40 ` Gour
  2013-09-04 10:15 ` G.B.
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Gour @ 2013-09-04  9:40 UTC (permalink / raw)


On Wed, 4 Sep 2013 02:14:55 -0700 (PDT)
e.s.harney@gmail.com wrote:

> I did look on Amazon about available books, but all of them seem
> fairly dated. "Programming in Ada 2005" by John Barnes did look
> interesting judging by the reviews, yet I'm not sure of how helpful
> it will be in covering all details that are relevant to writing
> useful software these days (things like utf8, interfacing with C,
> etc.).

I recently bought (starting with Ada as well) '95 version of Barnes -
got it very cheaply (>10GBP with shipping) and I believe and was told so
it's still quite relevant.

> Do you have any recommendations for me?

Here are some links:

a) Ada 95: The Craft of Object-Oriented Programming (http://archive.adaic.com/docs/craft/html/contents.htm)

b) Writing Ada Bindings for C Libraries - 3 parts (http://flyx.org/2012/06/13/adabindings1/)

c) Generating Ada bindings for C headers (http://www.adacore.com/adaanswers/gems/gem-59/) 

d) Ada-Python Binding (http://www.inspirel.com/articles/Ada_Python_Binding.html)

e) Ada Programming wiki book (http://en.wikibooks.org/wiki/Ada_Programming)

Hope it helps. ;)


Sincerely,
Gour

-- 
Never was there a time when I did not exist, 
nor you, nor all these kings; nor in the future 
shall any of us cease to be.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810



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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
  2013-09-04  9:40 ` Gour
@ 2013-09-04 10:15 ` G.B.
  2013-09-04 10:25 ` G.B.
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: G.B. @ 2013-09-04 10:15 UTC (permalink / raw)


On 04.09.13 11:14, e.s.harney@gmail.com wrote:
> I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).

A distilled introduction for programmers is

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

Barnes' book covers a lot; it needs the reader to work with it.

More links here:

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



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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
  2013-09-04  9:40 ` Gour
  2013-09-04 10:15 ` G.B.
@ 2013-09-04 10:25 ` G.B.
  2013-09-04 11:01   ` e.s.harney
  2013-09-04 12:04 ` mockturtle
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: G.B. @ 2013-09-04 10:25 UTC (permalink / raw)


On 04.09.13 11:14, e.s.harney@gmail.com wrote:
> I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).

That would depend on what "these days" turns out to be;
writing bindings to function libraries (code written in
C, say) is a concept from the 1970s. Not surprisingly,
that's a technique present in Ada's definition (LRM B.3,
B.4, and B.5). Still used. ISO 10646 is mandatory for
current Ada, so UTF-8 won't be a problem.

"These days", on PC hardware, chances are that binding
objects/types is more adequate than binding functions,
even on GNU/Linux.
Actually, Ada compilers for .NET or for the JVM do
just that in a natural way using tagged types.



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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 10:25 ` G.B.
@ 2013-09-04 11:01   ` e.s.harney
  2013-09-04 11:22     ` Peter C. Chapin
                       ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: e.s.harney @ 2013-09-04 11:01 UTC (permalink / raw)


Thank you for your replies and the links! So Ada95 books/resources are still a good place to get started for learning the language today then?

> writing bindings to function libraries (code written in
> C, say) is a concept from the 1970s.

Well, I'm only looking at it since Ada seems to be missing things like widely-used/extensively-tested HTTP or crypto libraries. So I'll have to figure out a way to using things like curl or openssl from Ada. I'm not sure if something more complex than simple function is really necessary for this.

Either way though, my point was that Barnes' book (judging by the table of contents on Amazon) does not seem to concern itself with how to get your program to do something useful. My guess is that in order to do so it would probably need another 200-300 pages explaining how to get your program to interact with the rest of the world.

> ISO 10646 is mandatory for
> current Ada, so UTF-8 won't be a problem.

That is interesting. What I had found through Google was this http://commons.ada.cx/Unicode which isn't really that helpful. 

How does Ada represent its strings internally? (Or more specifically, what character set do the standard library functions for processing strings assume/expect?).

Strings seem to be a hairy detail in many languages. Go uses uses utf8 everywhere; C has utf8 mostly these days but there's still things like wchar (and associated w* string function) around; Java uses UTF-16 and surrogate pairs; Python had something similar in version 2, but changed it to being fully-transparent (switches between 1-4 byte representation as needed) in version 3, and presents users only with characters; etc.

Is this covered by the reference manual for Ada?

On Wednesday, September 4, 2013 12:25:24 PM UTC+2, G.B. wrote:
> On 04.09.13 11:14, e.s.h...@gmail.com wrote:
> 
> > I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).
> 
> 
> 
> That would depend on what "these days" turns out to be;
> 
> writing bindings to function libraries (code written in
> 
> C, say) is a concept from the 1970s. Not surprisingly,
> 
> that's a technique present in Ada's definition (LRM B.3,
> 
> B.4, and B.5). Still used. ISO 10646 is mandatory for
> 
> current Ada, so UTF-8 won't be a problem.
> 
> 
> 
> "These days", on PC hardware, chances are that binding
> 
> objects/types is more adequate than binding functions,
> 
> even on GNU/Linux.
> 
> Actually, Ada compilers for .NET or for the JVM do
> 
> just that in a natural way using tagged types.

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 11:01   ` e.s.harney
@ 2013-09-04 11:22     ` Peter C. Chapin
  2013-09-04 12:15     ` Dmitry A. Kazakov
  2013-09-04 15:32     ` G.B.
  2 siblings, 0 replies; 22+ messages in thread
From: Peter C. Chapin @ 2013-09-04 11:22 UTC (permalink / raw)


On Wed, 4 Sep 2013, e.s.harney@gmail.com wrote:

> Thank you for your replies and the links! So Ada95 books/resources are 
> still a good place to get started for learning the language today then?

Yes, Ada95 materials are still relevant. They don't cover the new features 
of Ada2005 or Ada2012, of course, but with only a few little exceptions 
everything they do say is still true. Furthermore, Ada95 is still regarded 
by many as a perfectly reasonable language to use. ("I don't need no 
stink'n synchronized interfaces or executable contracts!")

One nice thing about Ada is that it has enjoyed an unusually (my opinion) 
high degree of coherence during its evolution. I send kudos to those who 
have labored to make that so. This isn't to say that it doesn't have warts 
and quirks but compared to, say, C++... well...

> Well, I'm only looking at it since Ada seems to be missing things like 
> widely-used/extensively-tested HTTP or crypto libraries. So I'll have to 
> figure out a way to using things like curl or openssl from Ada. I'm not 
> sure if something more complex than simple function is really necessary 
> for this.

Because Ada isn't as main stream as some other languages the menu of third 
party libraries available written in Ada is less than you would be used to 
coming from Java.

> Either way though, my point was that Barnes' book (judging by the table 
> of contents on Amazon) does not seem to concern itself with how to get 
> your program to do something useful.

The Barnes book is encyclopedic but it's not exactly a book about 
designing with Ada. He talks about some of the issues, but his focus is on 
presenting the raw language.

> How does Ada represent its strings internally? (Or more specifically, 
> what character set do the standard library functions for processing 
> strings assume/expect?).

There are three character types and corresponding string types.

 	Character
 	Wide_Character
 	Wide_Wide_Character

 	String
 	Wide_String
 	Wide_Wide_String

I'm sure the language lawyers here can set me straight if I get this wrong 
but my understanding is that Character is 8 bit ISO-8859-1, Wide_Character 
is 16 bit BMP part of ISO-10646, and Wide_Wide_Character is 32 bit full 
ISO-10646.

Ada source text is now assumed to be UTF-8 (or is that compilers must 
provide a mode where they accept UTF-8?).

> Is this covered by the reference manual for Ada?

There is a lot of dense language in the Ada standard regarding character 
sets.

Peter



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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (2 preceding siblings ...)
  2013-09-04 10:25 ` G.B.
@ 2013-09-04 12:04 ` mockturtle
  2013-09-04 12:25 ` Austin Obyrne
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: mockturtle @ 2013-09-04 12:04 UTC (permalink / raw)


Since you have some experience with Java, maybe you could give a look to
"Ada for the C++ or Java Developer" available at

   http://www.adacore.com/uploads_gems/Ada_for_the_C++_or_Java_Developer.pdf



On Wednesday, September 4, 2013 11:14:55 AM UTC+2, e.s.h...@gmail.com wrote:
> Some general details on my situation (that may be useful or not for the question; feel free to skip down to the "TL;DR" marker if you don't want to read them):
> 
> 
> 
> As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). 
> 
> 
> 
> Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). 
> 
> 
> 
> Looking at the other options available currently, Ada seemed like the best one (still actively maintained; competitive compiler; windows/linux-portability; .. at times I wonder if we'd be seeing thing like Rust or Go if Ada didn't still have its Pascal syntax...)
> 
> 
> 
> So here I am, looking into learning Ada.. I have dabbled in it (as well as Turbo Pascal) at various points in time for school/university courses, but those have been very shallow experiences.
> 
> 
> 
> TL;DR:
> 
> What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run)..
> 
> 
> 
> What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.
> 
> 
> 
> I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).
> 
> 
> 
> Do you have any recommendations for me?


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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 11:01   ` e.s.harney
  2013-09-04 11:22     ` Peter C. Chapin
@ 2013-09-04 12:15     ` Dmitry A. Kazakov
  2013-09-04 15:32     ` G.B.
  2 siblings, 0 replies; 22+ messages in thread
From: Dmitry A. Kazakov @ 2013-09-04 12:15 UTC (permalink / raw)


On Wed, 4 Sep 2013 04:01:14 -0700 (PDT), e.s.harney@gmail.com wrote:

> Well, I'm only looking at it since Ada seems to be missing things like
> widely-used/extensively-tested HTTP or crypto libraries.

There exist Ada libraries for this. The may be no single library, because
too much depends on the application in question.

As for extensive testing, I doubt that many libraries you have in mind
actually were.

Extensive should mean coverage tests, I suppose. Not the number of times
the same function with same parameters was called and nobody noticed it
crashed?

> How does Ada represent its strings internally? (Or more specifically, what
> character set do the standard library functions for processing strings
> assume/expect?).

There are three major groups of strings with regard of memory management:

1. Fixed size strings
2. Bounded variable strings
3. Unbounded strings

Usually, 90% of all cases is covered by #1. #2 is almost never used. #3 is
rarely used.

The representation of #1 depends on whether bounds of the string are
statically determinable, then it is the string body which is kept in the
memory, or indeterminable, then its the bounds ("dope") and the body. So
you are in full control. Since Ada can return #1 of unknown in advance size
on the stack, you almost never need #3.

> Strings seem to be a hairy detail in many languages. Go uses uses utf8
> everywhere; C has utf8 mostly these days but there's still things like
> wchar (and associated w* string function) around;

This is an orthogonal issue. A string is an array of code points. As such
it cannot be UTF-8 or not.

Encoding is a method of putting a string proper into another string (array)
of octets, words, whatever else memory units. Encoding is only important
for communicating to the outer world.

In Ada, the predefined strings of the category #1 may have one of the
following encodings:

1. Latin 1 (String)
2. UCS-2 (Wide_String)
3. UCS-4 (Wide_Wide_String)

For UTF-8 representations one usually uses Latin 1. There exist various
libraries for that, including the standard library. Similarly for UTF-16
one customary uses Wide_String (e.g. under Windows).

> Is this covered by the reference manual for Ada?

Yes, though finding answers in Ada RM may be a bit challenging.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (3 preceding siblings ...)
  2013-09-04 12:04 ` mockturtle
@ 2013-09-04 12:25 ` Austin Obyrne
  2013-09-04 15:00 ` Eryndlia Mavourneen
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Austin Obyrne @ 2013-09-04 12:25 UTC (permalink / raw)


On Wednesday, September 4, 2013 10:14:55 AM UTC+1, e.s.h...@gmail.com wrote:
> Some general details on my situation (that may be useful or not for the question; feel free to skip down to the "TL;DR" marker if you don't want to read them): As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). Looking at the other options available currently, Ada seemed like the best one (still actively maintained; competitive compiler; windows/linux-portability; .. at times I wonder if we'd be seeing thing like Rust or Go if Ada didn't still have its Pascal syntax...) So here I am, looking into learning Ada.. I have dabbled in it (as well as Turbo Pascal) at various points in time for school/university courses, but those have been very shallow experiences. TL;DR: What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run).. What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book. I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.). Do you have any recommendations for me?



Hi,

I’m a retired Engineer and I was first introduced to Ada-83 some 25 years ago – I liked the package concept of Ada and I liked also the kind of intuitive way the source code is written – I always resolved that I would later on learn more about the Ada programming language.  When my retirement came it was well into Ada-95 by that time and PC’s were well established to everyone but not to me – I was familiar with Ada through a main frame piece of directory and I was completely lost with getting started on Ada again via a PC this time.

I had huge difficulty and I sent off for some books (had to get some else to do it from me I was that green) – the person ordered the wrong book and I could well have quit at that point but I sent off again for this second book below and it prove to be my salvation.

There is a rather simplistic model of a Spider program that he uses for anybody that needs that kind of thing but in fairness it is a very good book.  I like the pedagogic style and he assumes nothing about the reader – he expands everything as the Ada enthusiast that he really is and everything is backed with worked examples for you to repeat.

The book comes with compilers that load very easily for Windows, Macos and Linux.

I recommend it and welcome you to the fold.

“Ada-95

Problem Solving and Programme Design” (hope it is still available)

Feldman/Koffman

Includes Ada 95 Compilers

ISBN 0 – 201 – 36123 – X

Good Luck with your studies – I hope  you will not find this too simplistic given your background.

Austin O’Byrne.

adacrypt.

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (4 preceding siblings ...)
  2013-09-04 12:25 ` Austin Obyrne
@ 2013-09-04 15:00 ` Eryndlia Mavourneen
  2013-09-04 16:05 ` e.s.harney
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Eryndlia Mavourneen @ 2013-09-04 15:00 UTC (permalink / raw)


On Wednesday, September 4, 2013 4:14:55 AM UTC-5, e.s.h...@gmail.com wrote:
> . . .
> What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.
> . . .
> Do you have any recommendations for me?

From your description of yourself as a programmer and the sort of language presentation you desire, I would think that the LRM itself would provide an excellent introduction for meeting your needs.  The 2012 LRM can be found at http://www.adaic.org/resources/add_content/standards/12rm/html/RM-TTL.html.  I personally find the LRM eminently readable, in general, although good books, online references, and the good people on Usenet can be very valuable, too.  Also check out the Ada Rationale books for all the Ada versions, which explain why a feature was included and in many cases how it is meant to be used.

-- Eryndlia Mavourneen (KK1T)

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 11:01   ` e.s.harney
  2013-09-04 11:22     ` Peter C. Chapin
  2013-09-04 12:15     ` Dmitry A. Kazakov
@ 2013-09-04 15:32     ` G.B.
  2 siblings, 0 replies; 22+ messages in thread
From: G.B. @ 2013-09-04 15:32 UTC (permalink / raw)


On 04.09.13 13:01, e.s.harney@gmail.com wrote:

> Well, I'm only looking at it since Ada seems to be missing things like widely-used/extensively-tested HTTP or crypto libraries. So I'll have to figure out a way to using things like curl or openssl from Ada. I'm not sure if something more complex than simple function is really necessary for this.

One popular library is AWS ("Ada Web Server"); it includes
HTTP, SMTP, and makes SSL available when the supporting
libraries are present on a system. (So, no need to write
bindings yourself.)

Maybe this web application framework is worth a look:
http://blog.vacs.fr/index.php?category/Ada

> Either way though, my point was that Barnes' book (judging by the table of contents on Amazon) does not seem to concern itself with how to get your program to do something useful. My guess is that in order to do so it would probably need another 200-300 pages explaining how to get your program to interact with the rest of the world.

The book surely covers techniques one might need
in order to tackle real world issues.

>> ISO 10646 is mandatory for
>> current Ada, so UTF-8 won't be a problem.
>
> That is interesting. What I had found through Google was this http://commons.ada.cx/Unicode which isn't really that helpful.
>
> How does Ada represent its strings internally? (Or more specifically, what character set do the standard library functions for processing strings assume/expect?).

Typically, an Ada compiler, like a C compiler (CHAR_BIT)
will find a representation for standard characters that
agrees with the requirements of the LRM and is a good
match for the given hardware  ;-) This includes passing
language borders.
For string I/O, see the String Encoding sections of the
standard library. Like Dmitry said, you are in control
here. That's not unlike Java when putting an encoding
object somewhere in the I/O chain.

Control extends to the possibility of defining your own
character types and strings of such characters, and add
representation clauses as needed. (A character is an
enumeration type.)

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (5 preceding siblings ...)
  2013-09-04 15:00 ` Eryndlia Mavourneen
@ 2013-09-04 16:05 ` e.s.harney
  2013-09-04 16:55   ` Dmitry A. Kazakov
  2013-09-04 18:46   ` Jeffrey R. Carter
  2013-09-04 16:09 ` Dan'l Miller
  2013-10-03 13:34 ` grodzicky_j
  8 siblings, 2 replies; 22+ messages in thread
From: e.s.harney @ 2013-09-04 16:05 UTC (permalink / raw)


> Extensive should mean coverage tests, I suppose. Not the number of times
the same function with same parameters was called and nobody noticed it
crashed? 

Perhaps my choice of words wasn't ideal.. What I really meant was not really tested in the context of unit tests, but something that is widely used or at least part of a widely used library (and thus checked/analyzed for conformance/compatibility/vulnerabilities, as well as optimized). 

I realize this isn't ideal, but popularity is pretty much the only metric I have to determining the quality of 3rd party libraries, considering that I probably lack the domain knowledge (as well as the large amounts of time) necessary to do this myself..

> Since Ada can return #1 of unknown in advance size
> on the stack, you almost never need #3. 

Yes, I remember using this in some exercises, because I didn't want to bother with learning how proper heap allocations work in Ada. 

Back then though, I thought of this as more of a hack, since I was creating lots of small functions that essentially just worked around the fact of not having a heap. Is this accepted practice when working with Ada?

How does Ada do these stack-allocations of variable size? Is there any performance downside to it? (e.g. by having to relocate things on the stack, or stacks getting huge?)

> This is an orthogonal issue. A string is an array of code points. As such
it cannot be UTF-8 or not. 

"Idealized" Spec and "conventions" (libraries/APIs) sort of drift apart here in most languages in my experience, which is why I haven't really perceived this as an orthogonal issue so far. (Things like the length function counting non-bmp "code points" differently depending on how the run time is compiled in python or counting always only the size in bytes in Go, or having no surrogate-aware substring functionality in Java, etc.)

Thank you for explaining what things look like in Ada, this is what I was looking for.

> the good people on Usenet can be very valuable, too

Yes, I'm pleasantly surprised by all the responses here. I did not expect this much activity, considering the age of the other threads.


On Wednesday, September 4, 2013 11:14:55 AM UTC+2, e.s.h...@gmail.com wrote:
> Some general details on my situation (that may be useful or not for the question; feel free to skip down to the "TL;DR" marker if you don't want to read them):
> 
> 
> 
> As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). 
> 
> 
> 
> Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). 
> 
> 
> 
> Looking at the other options available currently, Ada seemed like the best one (still actively maintained; competitive compiler; windows/linux-portability; .. at times I wonder if we'd be seeing thing like Rust or Go if Ada didn't still have its Pascal syntax...)
> 
> 
> 
> So here I am, looking into learning Ada.. I have dabbled in it (as well as Turbo Pascal) at various points in time for school/university courses, but those have been very shallow experiences.
> 
> 
> 
> TL;DR:
> 
> What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run)..
> 
> 
> 
> What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.
> 
> 
> 
> I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).
> 
> 
> 
> Do you have any recommendations for me?


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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (6 preceding siblings ...)
  2013-09-04 16:05 ` e.s.harney
@ 2013-09-04 16:09 ` Dan'l Miller
  2013-09-05  0:13   ` e.s.harney
  2013-09-10  9:16   ` Maurizio Tomasi
  2013-10-03 13:34 ` grodzicky_j
  8 siblings, 2 replies; 22+ messages in thread
From: Dan'l Miller @ 2013-09-04 16:09 UTC (permalink / raw)


On Wednesday, September 4, 2013 4:14:55 AM UTC-5, e.s.h...@gmail.com wrote:
> As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). 
> 
> Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). 
> [...snip...]
> TL;DR:
> What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run)..
> 
> What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.
> 
> I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).
> 
> Do you have any recommendations for me?

Well, there are generally 4 major eras of Ada:  Ada83, Ada95, Ada2005, Ada2012.  Ada83 (code-named Green during the competition) was a design-by-committee during the 1970s and early 1980s, but with a strong counter-cultural attitude by Jean Ichbiah, Green team's lead designer.  Some of that counter-cultural attitude has been beneficial (e.g., the vigorous pursuit of correct object lifetimes), whereas other portions of that counter-cultural attitude was Ada83's downfall (e.g., accomplishing goals via Draconian restrictions).  I came first to Ada83, then, after having been repulsed by its excessive restrictions and lack of runtime polymorphism, spent the next 20 years in C++, which was designed with the style of Ada83 done "correctly" from the C-minded slapstick perspective of the Marx Brothers' "Doctor it hurts when I do this!"  "Well, then don't do that!"  Like Austin Obyrne's posting above, I came back to modern Ada decades later, when I became repulsed to core of my being at C++'s (especially Boost Libraries') excessive use of (poorly-)emulated functional programming in the metatemplate programming style of using the Turing-complete (at compile-time) capabilities of C++ templates.  The compile-time error messages emitted by metatemplate programming is cryptic & obtuse at best, and little better that "unknown error at unknown location" at worst.  If this is what you mean by "knowing virtually nothing about what the syntax actually does" and "the intricate semantics of C++ were a deal-breaker", then you have completely grasped the current (dystopian) state of C++, and I wholeheartedly agree with you at some level much further along the learning curve.

But conversely if you mean that you do not understand the canonical implementation of virtual functions as a per-instance pointer to a type's virtual-function table singleton(-per-type) that is an array of runtime-polymorphic function-pointers to call, as the fundamental rubber-meets-the-road mechanism of OOP, then you need to read (for C++) Stan Lippman's _Inside the C++ object model_, which predates metatemplate programming and hence is not contaminated by that MTP filth.  The underlying underpinnings of C++ can be thought of as the child's play-toy version of the industrial-strength underlying underpinnings of Ada95-&-onward, with C++'s per-instance pointer to virtual-function table roughly analogous to Ada95-&-onward's tag in a tagged record, for example.  Independent of language, you need to learn what the "native" machine-language languages do.  I suspect that this book will really stoke the fire in your mind, solving many mysteries in pre-MTP C++, Ada95-&-onward, and even some C.  From this stronger basis in what "native"/"unmanaged" machine-language programming-languages do, your learning of Ada will likely be accelerated as you will be able to visualize in your mind what is happening at the machine-language level for each feature in Ada (even if no such textual explanation appears in the later Ada books that you are reading). http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/0201834545/ref=sr_1_1?s=books&ie=UTF8&qid=1378307415&sr=1-1&keywords=C%2B%2B+object+model

For C & C++ programmers coming to Ada95-&-onward, I recommend Norman Cohen's _Ada as a second language_, which for you, would be after you read Stan Lippman's underlying-underpinnings-of-C++ book above.  As with Stan Lippman's book, Norman Cohen's book predates metatemplate programming, so it is not polluted by that filth.  http://www.amazon.com/Ada-Second-Language-Norman-Cohen/dp/0070116075/ref=sr_1_5?s=books&ie=UTF8&qid=1378305539&sr=1-5&keywords=ada

The most lucid revelation of Ada2005 semantics (including Ada95) is (British) John Barnes's _Programming in Ada2005 with CD_.  I wish John Barnes would add another several hundred pages (perhaps as a Volume Two) and merge in the equivalent of Stan Lippman's underlying-underpinning book, but for Ada, so that the reader can crystal-clearly see "what the syntax actually does" under the hood.  There appear to be 2 types of learners:
1) those who love learning opaque black-boxes as opaque black-boxes, embracing the opaqueness to the nth degree.  (These people are not me, Stan Lippman, and apparently you.  John Barnes obviously loves voluminous details of the opaque black-box, and does an incredible job of revealing what the language does as an opaque black-box, describing its externally-observable behavior without significant reference to underlying underpinnings.
2) those who love learning how to correctly & smoothly (nonjerkingly) drive an automobile with a manual transmission by first looking at a diagram of how the clutch lever actuates a partial-slip/partial-friction plate, then getting behind the wheel in a parking lot to learn to feather in the slip-point on the clutch by visualizing in one's mind an imagined-animated variant of the diagram of the manual transmission.  Stan Lippman's book above is firmly in this school of thought.  Nancy Leveson wrote an entire book on how an accurately not-too-abstracted & not-too-hokus-pokus mental model is one of the most important aspects of learning a complex system correctly (e.g., so that the operators of a nuclear-fission power-plant know how the systems work well enough to respond correctly to various emergent scenarios).  This book is about a style of design for a style of deep learning, not a recommendation for your Ada learning and native machine-code object model learning (but apropos for validating precisely the style of lucidly-revealing learning that your original posting is yearning).  http://www.amazon.com/Safeware-Computers-Nancy-G-Leveson/dp/0201119722/ref=sr_1_fkmr1_1?s=books&ie=UTF8&qid=1378310557&sr=1-1-fkmr1&keywords=Nancy+Levinson+safeware
3) Then there are those people who (very partially, very badly) "learn" new things only by mangled analogy to opaque black-boxes that they already know.  They, for example, try to learn to drive a manual-transmission automobile by only direct & unembellished analogy to a automatic-transmission automobile.  Usually, such people with so-impaired thoughts never learn to drive a manual-transmission automobile correctly & smoothly until they disavow their ignorance (and likely join with us #2-type learners above, when some #2-type learner teaches how the underlying underpinnings of the clutch actually work).  Norman Cohen's book partially falls into this rut, and hence is supplemental reading material to fortify already-partially-learned Ada knowledge.  (Nancy Leveson's book lambastes this style of shallow learning and the misguided design style that evokes this shallowness.)

And when you get beyond basic Ada knowledge on towards intermediate, you should start reading sections of the Ada2012 (or Ada2005 or Ada95) rationale.  When you get to intermediate on towards advanced stage of learning, you should start reading section of the Ada2012 (or Ada2005 or Ada95) annotated reference, which is a further-embellished variant of the language standard.
http://www.ada-auth.org/standards/rationale12.html
and
http://www.adaic.org/ada-resources/standards

As you read Ada2012, Ada2005, and Ada95 material (perhaps in that reverse-chronological order), you will see Ada83 (codenamed Green) morph further & further toward the 2nd-place runner-up in the competition:  Red.  This is because Ada95, Ada2005, and Ada2012 was steered by the remnants of the Red team, after Green team's Jean Ichbiah resigned from his position of Distinguished Reviewer in protest against Ada95 (or some sanitized rewording thereof).  Studying redder-&-redder Ada95-&-onward along with pre-2000 C++ (predating the metatemplate programming filth) are complementary activities, because redder-&-redder Ada2005-&-onward is what 1990s pre-MTP C++ could have become.


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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 16:05 ` e.s.harney
@ 2013-09-04 16:55   ` Dmitry A. Kazakov
  2013-09-04 18:46   ` Jeffrey R. Carter
  1 sibling, 0 replies; 22+ messages in thread
From: Dmitry A. Kazakov @ 2013-09-04 16:55 UTC (permalink / raw)


On Wed, 4 Sep 2013 09:05:19 -0700 (PDT), e.s.harney@gmail.com wrote:

>> Extensive should mean coverage tests, I suppose. Not the number of times
>> the same function with same parameters was called and nobody noticed it
>> crashed? 
> 
> Perhaps my choice of words wasn't ideal.. What I really meant was not
> really tested in the context of unit tests, but something that is widely
> used or at least part of a widely used library (and thus checked/analyzed
> for conformance/compatibility/vulnerabilities, as well as optimized). 

Some Ada libraries are more popular some are less. I don't think that
popularity is much relevant. More important is whether the library is
maintained and, no less important, whether the maintainers bother keeping
it backward compatible. Most, if not all, Ada libraries are extremely
stable.

You may expect 20+ years old Ada code compiled with no or marginal changes,
and working.

> Back then though, I thought of this as more of a hack, since I was
> creating lots of small functions that essentially just worked around the
> fact of not having a heap. Is this accepted practice when working with
> Ada?

Yes, it is usually safer and more efficient than using unbounded strings
(which internally are allocated on the heap). For most applications a
string either comes from outside or is constant or has well defined limit
on its length (e.g. some buffer).

Dynamically allocated strings are overused and misused.

> How does Ada do these stack-allocations of variable size? Is there any
> performance downside to it? (e.g. by having to relocate things on the
> stack, or stacks getting huge?)

When you return a string from a function, it is not the function which
tells where the result is allocated:

   function Foo return String is
   begin
       return "foo";
   end Foo;

can be used as:

   X : String := Foo; -- This is on the stack

or

   type String_Ptr is access String;

   Y : String_Ptr := new String'(Foo); -- This is in the heap
 
or

   type Custom_Storage_Pool_Pointer is access String;
   for Custom_Storage_Pool_Pointer'Storage_Pool use My_Pool;

   Z : Custom_Storage_Pool_Pointer := new String'(Foo); -- Somewhere else

>> This is an orthogonal issue. A string is an array of code points. As such
> it cannot be UTF-8 or not. 
> 
> "Idealized" Spec and "conventions" (libraries/APIs) sort of drift apart
> here in most languages in my experience, which is why I haven't really
> perceived this as an orthogonal issue so far. (Things like the length
> function counting non-bmp "code points" differently depending on how the
> run time is compiled in python or counting always only the size in bytes
> in Go, or having no surrogate-aware substring functionality in Java, etc.)

In Ada there is S'Length which is the length of the array (and string) =
how many characters it has. There also is X'Size which tells how many bits
are needed to store X in memory. Size /= Length obviously.

If you bring encoding into it, then depending on which memory unit is used
by the encoding, you have encoding length in these units. E.g. UTF-8 uses
octets, UTF-16 uses words, ASCII uses chunks of 7-bits, RADIX-50 uses 5 1/3
bits ad so on.

Yes, libraries impose certain encoding, e.g. Windows A-calls use ASCII,
W-calls use UTF-16. That does not influence Ada program. If you look at Ada
interfaces to such libraries (which are called "bindings"), the design is
that you pass an Ada string to the procedure or get it from a function, and
it is the binding's business to convert it as appropriate. Ada is a
strongly typed language. You cannot do anything wrong. If the bindings is
thin, it rather deploys a string type native to the library. E.g. thin
bindings to C libraries are using char_array or chars_ptr . You cannot pass
String where char_array is expected. You must convert it using the function
To_C, which adds NUL etc. If you don't try to fool Ada compiler (in order
to getting performance boost, in 99.9% cases illusory), you are quite safe.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 16:05 ` e.s.harney
  2013-09-04 16:55   ` Dmitry A. Kazakov
@ 2013-09-04 18:46   ` Jeffrey R. Carter
  2013-09-04 20:35     ` Alan Jump
  2013-09-05  8:42     ` Jacob Sparre Andersen
  1 sibling, 2 replies; 22+ messages in thread
From: Jeffrey R. Carter @ 2013-09-04 18:46 UTC (permalink / raw)


On 09/04/2013 09:05 AM, e.s.harney@gmail.com wrote:
>
> How does Ada do these stack-allocations of variable size? Is there any performance downside to it? (e.g. by having to
> relocate things on the stack, or stacks getting huge?)

Ada doesn't do these. Specific implementations (compilers) do them, and may do them in different ways. In general, 
compilers are written by teams of experts who put a lot of effort into optimizing these things.

Ada is about letting software engineers think in the problem space, creating useful abstractions, without worrying about 
such low-level details, which are best left to the compiler. In nearly 30 yrs of using Ada, I have never encountered a 
situation in which low-level concerns had a positive effect on a project. I would recommend you concentrate on how to 
best use packages, since real modules would appear to be something you haven't had much exposure to.

For a real-world example, see "Ada Outperforms Assembly: A Case Study" 
(http://www.seas.gwu.edu/~adagroup/sigada-website/lawlis.html).

Concerning your original question, I second the suggestion of "Ada Distilled".

-- 
Jeff Carter
"Now go away or I shall taunt you a second time."
Monty Python and the Holy Grail

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 18:46   ` Jeffrey R. Carter
@ 2013-09-04 20:35     ` Alan Jump
  2013-09-05  8:42     ` Jacob Sparre Andersen
  1 sibling, 0 replies; 22+ messages in thread
From: Alan Jump @ 2013-09-04 20:35 UTC (permalink / raw)


On Wednesday, September 4, 2013 11:46:50 AM UTC-7, Jeffrey R. Carter wrote:
> 
> Concerning your original question, I second the suggestion of "Ada Distilled".
> 

I'll second the recommendation for "Ada Distilled", as well as Barnes' "Programming in Ada 2005". I'll also add recommendations for Naiditch's "Rendezvous with Ada 95" and ben Ari's "Ada for Software Engineers".

- -
73 de N5ILN
Alan

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 16:09 ` Dan'l Miller
@ 2013-09-05  0:13   ` e.s.harney
  2013-09-05 14:37     ` Mike H
  2013-09-10  9:16   ` Maurizio Tomasi
  1 sibling, 1 reply; 22+ messages in thread
From: e.s.harney @ 2013-09-05  0:13 UTC (permalink / raw)


> read (for C++) Stan Lippman's _Inside the C++ object model_

That looks fascinating. I have been looking up details on these topics, but it seems I've been looking in the wrong places so far. I never expected there to be books on the inner workings of production-grade compilers/runtimes.

If you have any more suggestions in this direction I would be very excited about them.

> If this is what you mean by "knowing virtually nothing about what the syntax actually does" and "the intricate semantics of C++ were a deal-breaker", then you have completely grasped the current (dystopian) state of C++

Metaprogramming/Generics through templates in C++ is bad, but this is not what I meant. To be fair, Stroustrup himself has condemned some of the template abuse in Boost as "too clever" and they're trying to improve the situation on this front by adding little details like static if and so on.. Also this is a hard problem to solve - mixing subtyping with parametric polymorphism (sort of the equivalent of "duck typing" in more dynamic languages). I'm not aware of any (strongly typed) language that pulls this off without messing up one way or the other (I've yet to look at Ada Generics though, and occaml supposedly has done it pretty sanely too, though the language never really appealed to me.)

Instead I'm more with the C++ FQA in that there is no one single thing that, when looked at in isolation, makes C++ bad. It is rather the way in which things interact that results in too much total complexity. 

Things like type compatibility with const-vs-non-const and const-type-vs-const-pointer, rvalues-vs-lvalues-vs-copies, "logical" const vs mutable vs c++11 "bitwise" const, function return being essentially implementation defined (due to compilers being allowed to exhibit different observable side effects when applying return value optimizations), unclear thread semantics due to "storage locations" being an "implementation defined" detail, and so on. 

And to top it all of, they added lambdas in C++11.. If you want to see some truly mindbogging piece of code (20 LOC only; nested self-capturing/calling reference-counted lambdas to simulate the async/await functionality in C#), look at slide 50 in this presentation by Herb Sutter (http://video.ch9.ms/sessions/build/2013/2-306.pptx or http://postimg.org/image/5xtnrnr63/ for just the piece of code if the PowerPoint file isn't working for you).

No one of these things would too hard to grasp when dealing with it alone, but add them all together and you're in for some real headache. I'm sure there's some reason everything ended up the way it is, but there's (imho) little reason to have to deal with all of it if there's no one actually forcing you to.


On Wednesday, September 4, 2013 6:09:51 PM UTC+2, Dan'l Miller wrote:
> On Wednesday, September 4, 2013 4:14:55 AM UTC-5, e.s.h...@gmail.com wrote:
> 
> > As a programmer that has spent most of his time in managed environments so far (Java mostly, with some PHP and Python here and there), I have been trying to get more into "native code" recently, in order to be able to control things like memory layout and get deterministic resource usage (and thus deterministic run time performance). 
> 
> > 
> 
> > Initially I started looking at C/C++, but soon realized that the intricate semantics of C++ were a deal-breaker (and not necessary for what I was looking for anyways) and that C lacked too many libraries (hash tables, file systems, threading, etc.) to be useful for one-man-projects these days (yes there's things like APR or GLib but those are quite a bit of a hassle). 
> 
> > [...snip...]
> 
> > TL;DR:
> 
> > What I am struggling the most when learning new languages is knowing virtually nothing about what the syntax actually does. I have tried some online tutorials that manage to walk me through the compilation process and then slowly introduce new languages pieces through example programs, but (for me at least) that has been a rather frustrating experience, considering that I'm essentially just copy-pasting code (and having to ignore irrelevant bits in the code that are not relevant yet, but still necessary for it to run)..
> 
> > 
> 
> > What I'm looking for is a text that starts from the other way, i.e. explains the language blocks, the data/object model, etc. first, and only after that goes on to provide full examples of working code. I guess this is something I'll only be able to find in a book.
> 
> > 
> 
> > I did look on Amazon about available books, but all of them seem fairly dated. "Programming in Ada 2005" by John Barnes did look interesting judging by the reviews, yet I'm not sure of how helpful it will be in covering all details that are relevant to writing useful software these days (things like utf8, interfacing with C, etc.).
> 
> > 
> 
> > Do you have any recommendations for me?
> 
> 
> 
> Well, there are generally 4 major eras of Ada:  Ada83, Ada95, Ada2005, Ada2012.  Ada83 (code-named Green during the competition) was a design-by-committee during the 1970s and early 1980s, but with a strong counter-cultural attitude by Jean Ichbiah, Green team's lead designer.  Some of that counter-cultural attitude has been beneficial (e.g., the vigorous pursuit of correct object lifetimes), whereas other portions of that counter-cultural attitude was Ada83's downfall (e.g., accomplishing goals via Draconian restrictions).  I came first to Ada83, then, after having been repulsed by its excessive restrictions and lack of runtime polymorphism, spent the next 20 years in C++, which was designed with the style of Ada83 done "correctly" from the C-minded slapstick perspective of the Marx Brothers' "Doctor it hurts when I do this!"  "Well, then don't do that!"  Like Austin Obyrne's posting above, I came back to modern Ada decades later, when I became repulsed to core of my being at C++'s (especially Boost Libraries') excessive use of (poorly-)emulated functional programming in the metatemplate programming style of using the Turing-complete (at compile-time) capabilities of C++ templates.  The compile-time error messages emitted by metatemplate programming is cryptic & obtuse at best, and little better that "unknown error at unknown location" at worst.  If this is what you mean by "knowing virtually nothing about what the syntax actually does" and "the intricate semantics of C++ were a deal-breaker", then you have completely grasped the current (dystopian) state of C++, and I wholeheartedly agree with you at some level much further along the learning curve.
> 
> 
> 
> But conversely if you mean that you do not understand the canonical implementation of virtual functions as a per-instance pointer to a type's virtual-function table singleton(-per-type) that is an array of runtime-polymorphic function-pointers to call, as the fundamental rubber-meets-the-road mechanism of OOP, then you need to read (for C++) Stan Lippman's _Inside the C++ object model_, which predates metatemplate programming and hence is not contaminated by that MTP filth.  The underlying underpinnings of C++ can be thought of as the child's play-toy version of the industrial-strength underlying underpinnings of Ada95-&-onward, with C++'s per-instance pointer to virtual-function table roughly analogous to Ada95-&-onward's tag in a tagged record, for example.  Independent of language, you need to learn what the "native" machine-language languages do.  I suspect that this book will really stoke the fire in your mind, solving many mysteries in pre-MTP C++, Ada95-&-onward, and even some C.  From this stronger basis in what "native"/"unmanaged" machine-language programming-languages do, your learning of Ada will likely be accelerated as you will be able to visualize in your mind what is happening at the machine-language level for each feature in Ada (even if no such textual explanation appears in the later Ada books that you are reading). http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/0201834545/ref=sr_1_1?s=books&ie=UTF8&qid=1378307415&sr=1-1&keywords=C%2B%2B+object+model
> 
> 
> 
> For C & C++ programmers coming to Ada95-&-onward, I recommend Norman Cohen's _Ada as a second language_, which for you, would be after you read Stan Lippman's underlying-underpinnings-of-C++ book above.  As with Stan Lippman's book, Norman Cohen's book predates metatemplate programming, so it is not polluted by that filth.  http://www.amazon.com/Ada-Second-Language-Norman-Cohen/dp/0070116075/ref=sr_1_5?s=books&ie=UTF8&qid=1378305539&sr=1-5&keywords=ada
> 
> 
> 
> The most lucid revelation of Ada2005 semantics (including Ada95) is (British) John Barnes's _Programming in Ada2005 with CD_.  I wish John Barnes would add another several hundred pages (perhaps as a Volume Two) and merge in the equivalent of Stan Lippman's underlying-underpinning book, but for Ada, so that the reader can crystal-clearly see "what the syntax actually does" under the hood.  There appear to be 2 types of learners:
> 
> 1) those who love learning opaque black-boxes as opaque black-boxes, embracing the opaqueness to the nth degree.  (These people are not me, Stan Lippman, and apparently you.  John Barnes obviously loves voluminous details of the opaque black-box, and does an incredible job of revealing what the language does as an opaque black-box, describing its externally-observable behavior without significant reference to underlying underpinnings.
> 
> 2) those who love learning how to correctly & smoothly (nonjerkingly) drive an automobile with a manual transmission by first looking at a diagram of how the clutch lever actuates a partial-slip/partial-friction plate, then getting behind the wheel in a parking lot to learn to feather in the slip-point on the clutch by visualizing in one's mind an imagined-animated variant of the diagram of the manual transmission.  Stan Lippman's book above is firmly in this school of thought.  Nancy Leveson wrote an entire book on how an accurately not-too-abstracted & not-too-hokus-pokus mental model is one of the most important aspects of learning a complex system correctly (e.g., so that the operators of a nuclear-fission power-plant know how the systems work well enough to respond correctly to various emergent scenarios).  This book is about a style of design for a style of deep learning, not a recommendation for your Ada learning and native machine-code object model learning (but apropos for validating precisely the style of lucidly-revealing learning that your original posting is yearning).  http://www.amazon.com/Safeware-Computers-Nancy-G-Leveson/dp/0201119722/ref=sr_1_fkmr1_1?s=books&ie=UTF8&qid=1378310557&sr=1-1-fkmr1&keywords=Nancy+Levinson+safeware
> 
> 3) Then there are those people who (very partially, very badly) "learn" new things only by mangled analogy to opaque black-boxes that they already know.  They, for example, try to learn to drive a manual-transmission automobile by only direct & unembellished analogy to a automatic-transmission automobile.  Usually, such people with so-impaired thoughts never learn to drive a manual-transmission automobile correctly & smoothly until they disavow their ignorance (and likely join with us #2-type learners above, when some #2-type learner teaches how the underlying underpinnings of the clutch actually work).  Norman Cohen's book partially falls into this rut, and hence is supplemental reading material to fortify already-partially-learned Ada knowledge.  (Nancy Leveson's book lambastes this style of shallow learning and the misguided design style that evokes this shallowness.)
> 
> 
> 
> And when you get beyond basic Ada knowledge on towards intermediate, you should start reading sections of the Ada2012 (or Ada2005 or Ada95) rationale.  When you get to intermediate on towards advanced stage of learning, you should start reading section of the Ada2012 (or Ada2005 or Ada95) annotated reference, which is a further-embellished variant of the language standard.
> 
> http://www.ada-auth.org/standards/rationale12.html
> 
> and
> 
> http://www.adaic.org/ada-resources/standards
> 
> 
> 
> As you read Ada2012, Ada2005, and Ada95 material (perhaps in that reverse-chronological order), you will see Ada83 (codenamed Green) morph further & further toward the 2nd-place runner-up in the competition:  Red.  This is because Ada95, Ada2005, and Ada2012 was steered by the remnants of the Red team, after Green team's Jean Ichbiah resigned from his position of Distinguished Reviewer in protest against Ada95 (or some sanitized rewording thereof).  Studying redder-&-redder Ada95-&-onward along with pre-2000 C++ (predating the metatemplate programming filth) are complementary activities, because redder-&-redder Ada2005-&-onward is what 1990s pre-MTP C++ could have become.



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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 18:46   ` Jeffrey R. Carter
  2013-09-04 20:35     ` Alan Jump
@ 2013-09-05  8:42     ` Jacob Sparre Andersen
  2013-09-05 14:34       ` Jeffrey R. Carter
  1 sibling, 1 reply; 22+ messages in thread
From: Jacob Sparre Andersen @ 2013-09-05  8:42 UTC (permalink / raw)


Jeffrey R. Carter wrote:

> In nearly 30 yrs of using Ada, I have never encountered a situation in
> which low-level concerns had a positive effect on a project.

I've had a few cases where I've had to implement work-arounds because
implementation choices in specific implementations of the standard
libraries gave order-of-magnitude slow-downs.

But except for those very few cases - and even in those cases, really -
I've been very happy with working on the high abstraction level until
specific issues showed up.

> Concerning your original question, I second the suggestion of "Ada
> Distilled".

Same here.  But it sounds like the reference manual itself might also be
a valuable learning resource in this specific case.

Greetings,

Jacob
-- 
»In Ada you model the problem space, not the solution space.«
                                                     -- Robert I. Eachus

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-05  8:42     ` Jacob Sparre Andersen
@ 2013-09-05 14:34       ` Jeffrey R. Carter
  0 siblings, 0 replies; 22+ messages in thread
From: Jeffrey R. Carter @ 2013-09-05 14:34 UTC (permalink / raw)


On 09/05/2013 01:42 AM, Jacob Sparre Andersen wrote:
>
> I've had a few cases where I've had to implement work-arounds because
> implementation choices in specific implementations of the standard
> libraries gave order-of-magnitude slow-downs.

I think that falls into the high-level area of choosing a better algorithm than the low-level, premature-optimization 
kind of thing.

-- 
Jeff Carter
"Now go away or I shall taunt you a second time."
Monty Python and the Holy Grail

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-05  0:13   ` e.s.harney
@ 2013-09-05 14:37     ` Mike H
  0 siblings, 0 replies; 22+ messages in thread
From: Mike H @ 2013-09-05 14:37 UTC (permalink / raw)


In message <7b8fb992-9fdb-48d2-8613-92e234e46f00@googlegroups.com>, 
e.s.harney@gmail.com writes
>I'm not aware of any (strongly typed) language that pulls this off 
>without messing up one way or the other
To say that Ada has rigorously strict typing rules is true. But that 
does not prevent type conversions. It merely constrains the programmer 
to declare a type conversion in an explicit manner that can be checked 
at compile time to ensure it is safe and unambiguous.

I can never ever remember a situation where these rules prevented me 
from doing what I needed to do. This is because one has the option of 
overriding the compiler's defaults. A declared type, whether simple or 
composite, can include representation clauses to define the size and bit 
pattern to be used at the level of machine storage. Given appropriate 
representation information, objects of one type may safely converted to, 
or mapped upon, one another.

My 1987 edition of Barnes has a brief introduction to the basics.
-- 
Mike
Swim? Naturally at Severn Vale
<http://www.severnvalesc.org/>


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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04 16:09 ` Dan'l Miller
  2013-09-05  0:13   ` e.s.harney
@ 2013-09-10  9:16   ` Maurizio Tomasi
  1 sibling, 0 replies; 22+ messages in thread
From: Maurizio Tomasi @ 2013-09-10  9:16 UTC (permalink / raw)


Thank you for this great post! I'll definitively take a look at "Ada as a second language" and "Inside the C++ object model".

Maurizio.

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

* Re: How (or Where?) to get started on Ada? (Properly)
  2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
                   ` (7 preceding siblings ...)
  2013-09-04 16:09 ` Dan'l Miller
@ 2013-10-03 13:34 ` grodzicky_j
  8 siblings, 0 replies; 22+ messages in thread
From: grodzicky_j @ 2013-10-03 13:34 UTC (permalink / raw)


On Wednesday, September 4, 2013 7:14:55 PM UTC+10, e.s.h...@gmail.com wrote:
> Some general details on my situation (that may be useful or not for the question; feel free to skip down to the "TL;DR" marker if you don't want to read them):
> 
{snip}
> 
> Do you have any recommendations for me?

I have just come across the Ada University on the adacore website:

http://university.adacore.com/

Though I think it may be too basic for you.


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

end of thread, other threads:[~2013-10-03 13:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04  9:14 How (or Where?) to get started on Ada? (Properly) e.s.harney
2013-09-04  9:40 ` Gour
2013-09-04 10:15 ` G.B.
2013-09-04 10:25 ` G.B.
2013-09-04 11:01   ` e.s.harney
2013-09-04 11:22     ` Peter C. Chapin
2013-09-04 12:15     ` Dmitry A. Kazakov
2013-09-04 15:32     ` G.B.
2013-09-04 12:04 ` mockturtle
2013-09-04 12:25 ` Austin Obyrne
2013-09-04 15:00 ` Eryndlia Mavourneen
2013-09-04 16:05 ` e.s.harney
2013-09-04 16:55   ` Dmitry A. Kazakov
2013-09-04 18:46   ` Jeffrey R. Carter
2013-09-04 20:35     ` Alan Jump
2013-09-05  8:42     ` Jacob Sparre Andersen
2013-09-05 14:34       ` Jeffrey R. Carter
2013-09-04 16:09 ` Dan'l Miller
2013-09-05  0:13   ` e.s.harney
2013-09-05 14:37     ` Mike H
2013-09-10  9:16   ` Maurizio Tomasi
2013-10-03 13:34 ` grodzicky_j

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