Ioannis Vranos said:
You can't protect a bad programmer from doing bad programming, unless you forbid him to
continue programming.
You can provide tools that help the good programmer be a better
programmer. In my experience, Ada does just that.
I am one of those people who appeciates having tools that make
my job easier, whether for software development or for other
activities. I would rather use a socket wrench of the right
dimensions than an adjustable wrench. I prefer to use a bread
knife for my sourdough bread than a paring knife. I find it
easier, and safer, to use sharp axe for splitting logs than a
small hatchet. In each case, I can do the job with the less
effective tool, but the specialization of the tool makes my
life a little better.
There is rarely a programming problem I cannot express in
Ada. Sometimes I need to use one of the libraries instead
of the language itself. An example, in a separate thread,
is the use of decimal fraction exponent in a power expression.
The math library is required. This is a little safer that having
it directly in the language. It also simplifies the compiler a
bit. If I really need to do address arithmetic, I can, but I
rely on one of the child units of package System for this. That
library unit reduces the chances of my making stupid mistakes.
As Pascal Obry noted, Ada does forbid some things in the
core language. It forbids some unsafe things. However,
we can, if we wish, relax the rules of the language to do
unsafe things. There are all kinds of unchecked features,
and because they are unchecked, the programmer knows
the dangers. There are specialized packages that help
the programmer circumvent otherwise unsafe constructs.
It is easier to start with a language where the default for
most constructs is "safe" and relax the safety than it is
to start with a language such as C++ where the default is
generally "unsafe" and make it safer. In fact, with an
unsafe language there is little incentive for most programmers
to even try to find ways to make it more safe. I speak from
experience here. I have seen no end of C++ activity where
the programmers blithely grind out code where the compiler
cannot detect the unsafe parts of the program from those that
might be (we cannot be sure) safe.
Safe programming might be possible in C++. It is not common
in C++ programming practice. Unsafe programming might be
possible in Ada, but it is not common in Ada practice.
Richard Riehle