[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arithmetic overflow [was Re: the benefits of immutability]




Hello,

On Wed, Aug 20, 2003 at 12:52:19PM -0400, Matthias Felleisen wrote:
> On Wednesday, August 20, 2003, at 11:49 AM, James Y. Knight wrote:
> >On Tuesday, August 19, 2003, at 04:09  PM, Perry E. Metzger wrote:
> >>The pathetic thing about Java is that not only is it crippled to make
> >>it safe, but it isn't even safe. Overflows, for example, are ignored,
> >>presumably to make it look more like C. Yuck.
> >
> >You're talking about a different definition of safe. Java is safe in 
> >that you can safely run random code downloaded off the internet on 
> >your local machine without it being able to send out spam to everyone 
> >on the planet, upload all your personal information to the author, and 
> >then erase your hard drive. It is not safe against writing incorrect 
> >code. However, it does have many features that make it *easier* to 
> >write correct code (e.g. garbage collection, required exception 
> >handling).
> 
> That's not save, that's secure.
> 
> Safe: the language doesn't interpret bits from one set of values as if 
> they belonged to a different one,
>  where "set of values" is defined at the syntactic level. Examples of 
> safe languages: PLT Scheme, Java.

Note that (from java.lang.{Float,Double}):

  static int Float.floatToIntBits (float value);
  static float Float.intBitsToFloat (int bits);
  static long Double.doubleToLongBits (double value);
  static double Double.longBitsToDouble (long bits);

Java only protects object references from being forged.

[deletia] 

Cu,
Dash.

-- 
Formal symbolic representation of qualitative entities is doomed to its
rightful place of minor significance in a world where flowers and beautiful
women abound.
		-- Albert Einstein
-- 
http://users.swing.be/diederen/