comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Introductory Ada Programming Book
Date: Thu, 5 Jan 2017 07:36:46 +0100
Date: 2017-01-05T07:36:46+01:00	[thread overview]
Message-ID: <o4kpf8$r4j$1@dont-email.me> (raw)
In-Reply-To: <5b52afcc-120e-41a5-bab2-7f5c6f647cc2@googlegroups.com>

Le 04/01/2017 à 14:44, raph.amiard@gmail.com a écrit :
> I'm in contact with the author so I'll pass any fixes up to him if you don't mind
Well, I suggested help from the community at large because currently I
don't have the time to make an extensive review. Otherwise, I'd write to
him myself...

Some have already responded; my $0.02

>> Oddly, variables are not initialised by default
>> (Personal opinion: default initialization is a huge mistake)
> 
> Ok but, besides the "oddly" qualifier, his statement is correct, right ?
> 
Asking for automatic initialization comes generally from people using
the C like languages, who automatically think of 0 as the initial value.
A truely magical value, meaning number 0, false, string termination,
etc. It makes no sense for Ada, where types may not include 0 as an
allowed value. You can even have types with no value at all; what would
the initial value be?

But the issue is worth than that. A program that does not initialize a
variable before using it has a bug. If the program works because the
compiler provided a default value that happened to have an appropriate
value, it's a buggy program that works by chance. In the safety critical
world, we don't want programs that work by chance; we want programs
without bugs. That's why the only acceptable initial value is an invalid
value (as provided by Initialize_Scalars), because it maximizes the
probability of catching the bug early.

>> Ada is, alas, a one-pass language, so things need to be prototyped if
>> you're going to refer to them before they're defined.
> 
> This is generally true, and the areas of the language where it's not
(aspects) are full of gotchas. While it's not always true, my feeling is
that there *was* a strong push to keep Ada compilable by a one pass
compiler (which GNAT is, in broad strokes).
> 
I don't think that one pass was ever a requirement for Ada. Claiming
that some things are "unfortunately" the way they are to make compilers
naively simpler sends a wrong message, and is unfair to the huge work
performed by compilers.


-- 
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


  parent reply	other threads:[~2017-01-05  6:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
2016-12-31 14:26 ` Lucretia
2016-12-31 15:10   ` Dmitry A. Kazakov
2016-12-31 17:14     ` Andrew Shvets
2016-12-31 14:28 ` Lucretia
2016-12-31 14:34 ` Lucretia
2016-12-31 17:22   ` Andrew Shvets
2016-12-31 17:59 ` Gour
2017-01-02 15:56   ` Andrew Shvets
2017-01-02 16:32     ` Gour
2017-01-03 15:31 ` Patrick Noffke
2017-01-03 22:18   ` Andrew Shvets
2017-01-04  1:14 ` Paul Rubin
2017-01-04  3:07   ` Andrew Shvets
2017-01-04  6:46     ` J-P. Rosen
2017-01-04  9:25       ` raph.amiard
2017-01-04 12:40         ` J-P. Rosen
2017-01-04 12:49           ` Dmitry A. Kazakov
2017-01-04 13:45             ` raph.amiard
2017-01-04 14:14               ` Dmitry A. Kazakov
2017-01-04 15:15                 ` Simon Wright
2017-01-10 10:02                 ` raph.amiard
2017-01-04 15:18               ` Shark8
2017-01-04 21:47                 ` Randy Brukardt
2017-01-05  3:04                   ` Shark8
2017-01-05  7:51                     ` G.B.
2017-01-04 13:44           ` raph.amiard
2017-01-04 22:08             ` Jeffrey R. Carter
2017-01-04 22:39             ` Niklas Holsti
2017-01-05  0:38               ` G.B.
2017-01-05 23:52               ` Randy Brukardt
2017-01-05  6:36             ` J-P. Rosen [this message]
2017-01-05  8:38               ` Simon Wright
2017-01-10 10:13               ` raph.amiard
2017-01-09 22:01             ` Robert Eachus
2017-01-04 23:42 ` Andrew Shvets
2017-01-05  0:47   ` G.B.
2017-01-05 19:01   ` Jacob Sparre Andersen
replies disabled

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