comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Ada and Java. different behaviour. casting long to int problem.
Date: 1999/06/13
Date: 1999-06-13T00:00:00+00:00	[thread overview]
Message-ID: <7jvcqv$od9$1@nnrp1.deja.com> (raw)
In-Reply-To: 7jv4bh$11rg@drn.newsguy.com

In article <7jv4bh$11rg@drn.newsguy.com>,
  kirck@nospam.com wrote:

> Ok, so the bottom line of all this, is that Java (and C and
> C++) all blew it, and Ada did not.

I disagree strongly with this statement. Java has well defined
portable semantics for its arithmetic operations. It is the
programmers responsibility to know these semantics and use them
in an appropriate manner.

A programmer who casually expects Java to check for overflow
in a situation where it is well defined that it does not is
incompetent, and it is unreasonable to blame Java for such
incompetence.

Now one may argue about whether Java's semantic choice is the
right one, and I certainly prefer the Ada choice, but I think
it is too harsh to say that "Java blew it", there is nothing
fundamentally more moral or correct about Ada's semantics here.
We are simply talking about the pragmatic issue of which
semantic model makes it easier to write reliable programs.

> I hope I do not see Java used to implement the software that
> will launch the next rocket to space, or process my bank
> financial statement.

Competent programmers can certainly write realiable software
in Java for these functions. I agree it is *easier* to write
the same reliable software in Ada, but trying to imply that
Java is somehow fundamentally unsafe is another case of
excessive negative comment on non-Ada languages by Ada advocates
and that is not helpful!

> I'd rather see a language that catches such basic errors on
> the spot like Ada did in the example, not hide them under the
> cover.

There is no basic error here in the Java case, just a
misunderstanding by the programmer. If you don't know the
rules of your language, you may well make a mess of things!
In Java if you add 1 to the largest positive number, you get
the most negative number. This is not an error, let alone a
basic error, it is simply what adding 1 is defined to do!

Now if this is NOT the function you need, and instead you need
to check that the result does not exceed the largest positive
number, you need to program the check that you need. Yes, it is
easier in Ada to do this check, but that does not mean that
there is something fundamentally unsafe about Java here.



Robert


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-06-13  0:00 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-12  0:00 Ada and Java. different behaviour. casting long to int problem nabbasi
1999-06-12  0:00 ` nabbasi
1999-06-12  0:00   ` jerry
1999-06-12  0:00     ` Robert Dewar
1999-06-14  0:00       ` Marin David Condic
1999-06-12  0:00 ` Tucker Taft
1999-06-12  0:00   ` Keith Thompson
1999-06-12  0:00     ` kirck
1999-06-13  0:00       ` Robert Dewar [this message]
1999-06-12  0:00         ` Fred
1999-06-14  0:00           ` Mark Hood
1999-06-15  0:00             ` mike
1999-06-15  0:00               ` D'Arcy Smith
1999-06-16  0:00                 ` George W. Bayles
1999-06-16  0:00                   ` D'Arcy Smith
1999-06-17  0:00                   ` Matthew Heaney
1999-06-17  0:00                   ` Aidan Skinner
1999-06-15  0:00               ` Marin David Condic
1999-06-15  0:00                 ` Mike Silva
1999-06-15  0:00                   ` rich
1999-06-15  0:00                     ` Marin David Condic
1999-06-15  0:00                       ` D'Arcy Smith
1999-06-15  0:00                         ` Keith Thompson
1999-06-16  0:00                           ` bill
1999-06-16  0:00                             ` George W. Bayles
1999-06-16  0:00                               ` Fraser Wilson
1999-06-17  0:00                               ` Aidan Skinner
1999-06-17  0:00                                 ` David Botton
1999-06-18  0:00                                   ` Dale Stanbrough
1999-06-18  0:00                                     ` David Botton
1999-06-18  0:00                                       ` Pascal Obry
1999-06-18  0:00                                     ` Matthew Heaney
1999-06-17  0:00                               ` Chris Dollin
1999-07-20  0:00                             ` Geoff Bull
1999-06-16  0:00                           ` D'Arcy Smith
1999-06-16  0:00                         ` Mike Silva
1999-06-16  0:00                           ` D'Arcy Smith
1999-06-16  0:00                             ` kirk
1999-06-16  0:00                               ` D'Arcy Smith
1999-06-17  0:00                                 ` Markus Kuhn
1999-06-17  0:00                                   ` john
1999-06-17  0:00                                     ` Ed Falis
1999-06-18  0:00                                     ` Aidan Skinner
1999-06-17  0:00                                   ` D'Arcy Smith
1999-06-16  0:00                               ` Hyman Rosen
1999-06-17  0:00                                 ` Markus Kuhn
1999-06-17  0:00                                 ` Jean-Pierre Rosen
1999-06-17  0:00                                   ` Marin David Condic
1999-06-17  0:00                                     ` Samuel Mize
1999-06-17  0:00                                       ` Marin David Condic
1999-06-22  0:00                                         ` Hyman Rosen
1999-06-22  0:00                                           ` Keith Thompson
1999-06-23  0:00                                             ` Marin David Condic
1999-06-24  0:00                                               ` Robert A Duff
1999-06-24  0:00                                                 ` Marin David Condic
1999-06-23  0:00                                           ` Marin David Condic
1999-06-18  0:00                                       ` Aidan Skinner
1999-06-17  0:00                                 ` Robert I. Eachus
1999-06-17  0:00                                   ` Hyman Rosen
1999-06-17  0:00                                     ` Marin David Condic
1999-06-17  0:00                                     ` bob
1999-06-18  0:00                                       ` Hyman Rosen
1999-06-18  0:00                                         ` mike
1999-06-18  0:00                                           ` Hyman Rosen
1999-06-19  0:00                                             ` Samuel Mize
1999-06-21  0:00                                               ` Marin David Condic
1999-06-19  0:00                                             ` Dale Stanbrough
1999-06-21  0:00                                               ` Marin David Condic
1999-06-21  0:00                                             ` Mike Silva
1999-06-20  0:00                                 ` Sera Hirasuna
1999-06-19  0:00                                   ` Kio
1999-06-20  0:00                                   ` Vladimir Olensky
1999-06-21  0:00                                   ` Hyman Rosen
1999-06-21  0:00                                   ` Samuel T. Harris
1999-06-22  0:00                                     ` Richard D Riehle
1999-06-22  0:00                                     ` Robert I. Eachus
1999-06-23  0:00                                       ` Richard D Riehle
1999-06-23  0:00                                       ` Aidan Skinner
1999-06-17  0:00                           ` Jean-Pierre Rosen
1999-06-16  0:00                         ` Marin David Condic
1999-06-16  0:00                         ` George W. Bayles
1999-06-16  0:00                           ` D'Arcy Smith
1999-06-16  0:00                           ` Tucker Taft
1999-06-17  0:00                             ` George W. Bayles
1999-06-17  0:00                               ` Tucker Taft
1999-06-17  0:00                                 ` bob
1999-06-16  0:00                           ` D'Arcy Smith
1999-06-17  0:00                           ` Larry Kilgallen
1999-06-22  0:00                       ` Robert Dewar
1999-06-23  0:00                         ` Marin David Condic
1999-06-23  0:00                           ` Vladimir Olensky
1999-06-23  0:00                             ` Marin David Condic
1999-06-23  0:00                             ` Roedy Green
1999-06-23  0:00                               ` Marin David Condic
1999-06-23  0:00                                 ` Keith Thompson
1999-06-24  0:00                                   ` Mike Silva
1999-06-24  0:00                                   ` Marin David Condic
1999-06-15  0:00                     ` tmoran
1999-06-15  0:00                       ` David Botton
1999-06-16  0:00                       ` Samuel Mize
1999-06-16  0:00                       ` Richard D Riehle
1999-06-15  0:00                     ` Samuel Mize
1999-06-16  0:00                 ` Mark Hood
1999-06-17  0:00                   ` Jean-Pierre Rosen
1999-06-17  0:00                 ` Robert I. Eachus
1999-06-17  0:00                   ` Marin David Condic
1999-06-15  0:00               ` Samuel Mize
1999-06-15  0:00                 ` jerry
1999-06-16  0:00                   ` Richard D Riehle
1999-06-16  0:00                     ` jerry
1999-06-17  0:00             ` Markus Kuhn
1999-06-17  0:00               ` David Botton
1999-06-12  0:00   ` PPAATT
1999-06-13  0:00   ` Robert Dewar
1999-06-14  0:00     ` tmoran
1999-06-30  0:00       ` John Merryweather Cooper
1999-07-01  0:00         ` Chad R. Meiners
1999-07-02  0:00           ` Robert Dewar
1999-07-02  0:00             ` John Merryweather Cooper
1999-07-03  0:00               ` Robert Dewar
replies disabled

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