Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 15 May 2011 09:35:33 -0500 Date: Sun, 15 May 2011 07:35:30 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Java puzzler References: <4db69c13-878f-4806-adb2-a3c5adb1c48c@glegroupsg2000goo.googlegroups.com> <-8mdnSRPEIdA21HQnZ2dnUVZ_j2dnZ2d@earthlink.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 24 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-FO1ehmPGe6a323iDe5QOszWIPrwNxxwsEOlMaemzV+A9BOHWa6d2cLxF62T3aI4BNk+MJD/fJjPWWBI!cu6uv/+4XzGFIMeyJ22t/FLcnSwxgz6azn86UokVUmnWfPy5Udy/+IXu5hvkw4eBSDRpJHoM3pEd!Whutnu4jGhXPhP5AUXRSpjAG/AyUKWAq8WMr87CZszk= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2977 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4117 On 5/15/2011 3:16 AM, Tom Anderson wrote: ... > Fair enough. I suppose my position is that this hardware ability has to > be used in the service of some solidly well-defined software semantics. > Throwing exceptions at random from arithmetic expressions is not what i > think of as solidly well-defined. ... I agree. Throwing an exception if *any* expression evaluation results in a value that is not representable in the type of the expression would not be "at random". It would be well-defined through the existing specification of how to evaluate arithmetic expressions. Making the throw dependent on whether and how the expression had been optimized would make it unpredictable, and varying from compiler version to compiler version, a very bad thing. I don't think adding exceptions for arithmetic overflow would be a sensible change as a modification for Java. If it affected existing code it would break a lot of programs. If it did not, it would add a lot of complexity to the language. It is something that might be useful in a language designed for it. Patricia