comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: The revolution will not be standardized
Date: 2000/01/05
Date: 2000-01-05T00:00:00+00:00	[thread overview]
Message-ID: <wcc7lho9n4g.fsf@world.std.com> (raw)
In-Reply-To: 83ubgv$mlv$1@nntp5.atl.mindspring.net

Richard D Riehle <laoXhai@ix.netcom.com> writes:

> In article <83sb2d$r1i$1@nnrp1.deja.com>,
> 	Robert Dewar <robert_dewar@my-deja.com> wrote:
> 
> >In article <wcc66xruh8n.fsf@world.std.com>,
> >  Robert A Duff <bobduff@world.std.com> wrote:
> >> Richard D Riehle <laoXhai@ix.netcom.com> writes:
> >>
> >> Speaking of which, I've heard many people say that Java is
> >just like
> >> Ada, except that it uses C syntax.  That is nonsense, in my
> >opinion:
> >> Java inherits many error-prone "features" not present in Ada.
> >
> >
> >Naturaly it goes without saying that it would be VERY useful
> >if yoou could expand on the above statement :-)
> 
> I did not originate that assessment of Java.  I think it was
> part of some other posting earlier.  It is now so far from the
> source, nested within some other reply, that I am not sure of
> its origins.

I'm the one who wrote the "Speaking of which..." quote above.  Robert
replied challenging me to expand on that statement.  I could write a
book on the subject.  I didn't answer Robert because I don't have time
to be writing books right now.  ;-)

Anyway, here are some examples of what I had in mind.  These are cases
of error-prone features in Java that are not present in Ada.  Some (not
all) of these features are inherited from C.  My contention is that Java
went to a lot of trouble to eliminate problems in C that would cause
*security* problems, but Java didn't try very hard to eliminate plain
old *bugs*.  Or "programming mistakes", if you prefer.  ;-)

The dangling else problem.

Alternatives of a switch statement fall through, unless you use break --
but you almost never want to fall through.

No full-coverage rules on switch statements -- if there's no default,
it does nothing.

Everything's a reference, so everything is aliased.  (Well, *almost*
everything.)  Who knows what might hang on to a pointer to so-and-so?
In other words, the whole point of local variables is defeated -- local
variables can sneakily escape their scope, and you can't tell by reading
the code.

Elaboration/initialization rules.

Wrap-around semantics on integer arithmetic.

The integer types are, in general, very machine-oriented.  Bit-wise
logical operators and shifts have the same status as addition and
subtraction.  Ada's modular types have the same problem, but at least in
Ada, you can usually use a signed integer type for counting things and
whatnot, and get more reasonable semantics.  (Modular types are not my
favorite Ada feature.  Shall I post a diatribe on that point? ;-) )

21 is a different number than 2l.

0011 is different from 11.

Java encourages side-effects buried within expressions.

Container types lose compile-time type checking.  This is because there
are no generics.  (On the other hand, I must say: it's nice to have lots
of container types predefined and standard!)

No proper constant declarations (in the Ada sense).
No 'in'-mode parameters (because everything's a pointer).

No packing.

No named-notation calls.

I hate reading 10000000 when I could read 10_000_000 instead.

No subranges.

No new integer types.

No enumeration types.

================================================================

On the other hand, there are some counter-examples to my point above.
For example, Java makes a distinction between boolean and integers.
This is not necessary for security, but it does help prevent bugs, make
programs more readable, and all that good stuff.

Java also has some features that are *less* error-prone than Ada:

Garbage collection.

Treatment of uninitialized variables.

Declaring what exceptions are propagated.  (Although the design is
imperfect -- it leads to "crying wolf" too often, IMHO.)

No dead code allowed.

Fewer implementation-dependent cases.  Implementation dependence causes
trouble because it's easy to write code that accidentally depends on
some implementation-dependent thing, but happens to work using the
current compiler on the current machine.  Then the bug is found later,
after the original programmer has forgotten or gone.

================================================================

I guess the one thing I admire most about Java is its strict insistence
on portability.  I think that's a Good Thing.  On the other hand, in
practise, what matters is what implementations do, which is not
something the language designer can control.

- Bob




  reply	other threads:[~2000-01-05  0:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-09  0:00 The revolution will not be standardized Ted Dennison
1999-12-10  0:00 ` Ed Falis
1999-12-10  0:00   ` Ted Dennison
1999-12-12  0:00   ` Geoff Bull
1999-12-12  0:00     ` Robert Dewar
1999-12-13  0:00       ` Geoff Bull
1999-12-13  0:00         ` Larry Kilgallen
1999-12-14  0:00           ` Geoff Bull
1999-12-13  0:00     ` Ted Dennison
1999-12-13  0:00       ` reason67
1999-12-13  0:00         ` Aidan Skinner
1999-12-14  0:00           ` Geoff Bull
1999-12-14  0:00             ` Richard D Riehle
1999-12-14  0:00               ` Marin D. Condic
1999-12-14  0:00                 ` Greg Martin
1999-12-14  0:00                   ` Marin D. Condic
1999-12-15  0:00                     ` Greg Martin
1999-12-15  0:00                     ` Ted Dennison
1999-12-16  0:00                       ` Marin D. Condic
1999-12-21  0:00                       ` Geoff Bull
1999-12-21  0:00                         ` Robert Dewar
1999-12-21  0:00                           ` Richard D Riehle
1999-12-22  0:00                             ` Robert A Duff
1999-12-23  0:00                               ` Robert Dewar
1999-12-23  0:00                                 ` Ehud Lamm
1999-12-23  0:00                                   ` gnat 3.12 Michael Ben-Gershon
1999-12-23  0:00                                     ` Robert Dewar
1999-12-23  0:00                                 ` The revolution will not be standardized Richard D Riehle
2000-01-05  0:00                                   ` Robert A Duff [this message]
2000-01-06  0:00                                     ` Robert Dewar
2000-01-06  0:00                                     ` Robert Dewar
2000-01-06  0:00                                       ` Robert A Duff
2000-01-07  0:00                                         ` Robert Dewar
2000-01-06  0:00                                       ` Robert A Duff
1999-12-15  0:00                   ` Ted Dennison
1999-12-14  0:00             ` Ted Dennison
1999-12-15  0:00               ` Geoff Bull
1999-12-15  0:00                 ` Preben Randhol
1999-12-14  0:00             ` reason67
1999-12-14  0:00       ` Geoff Bull
replies disabled

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