From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/17 Message-ID: <37696AB3.5A0A806B@pwfl.com>#1/1 X-Deja-AN: 490827987 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <3766650F.705125B7@pwfl.com> <7k64t7$igo$1@its.hooked.net> <7k689a$ci2@drn.newsguy.com> <3766C842.E1EAB60A@pwfl.com> <3766D1CC.D712895E@itools.symantec.com> <7k8nn5$qcb$1@its.hooked.net> <3767E8A2.EF1A0570@itools.symantec.com> <7k8tv3$3gm@drn.newsguy.com> <3769506F.157411C0@mitre.org> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada Date: 1999-06-17T00:00:00+00:00 List-Id: Hyman Rosen wrote: > All I'm saying is that exceptions are better than wraparound only in > the test/debug environment. Out in the field, especially when the > software must work the first time, exceptions are probably going to be > more harmful than wraparound, because the former causes a large part > of the code to abruptly abort, while the latter causes a local > error. In many cases, the local error just causes a glitch but the > system as a whole can continue working. Well.... Let's try something a little more specific: Exceptions vs wraparound vs saturation and which is "better in the field" is going to depend a whole lot on which field. For example, in most commercial data processing applications, an exception is far superior to any other semantics because the problem of failing the program is not nearly so costly as the problem of putting a wrong balance in someone's checking account. Whereas, for the kind of embedded control that I work with, saturation is far superior to an exception and way far better than wraparound. If you command an LVDT to go "too far" and the number saturates, you just drive to the limit of the device. If you raise an exception, then at least the control may go to fail-fixed or fail-safe and things may work out all right. However, if you wraparound, you're going to instantaneously command the device in the exact opposite direction at full power - an event that has a bad habit of resulting in energetic disassembly. So I think the correct answer is that a language which aspires to address a wide variety of problem domains should make it possible through classes of types to pick the semantics appropriate for the situation. Ada kind of does it, but IMHO could benefit from numeric classes with other defined behaviors. (Most notably, saturation would be very beneficial to our domain, and probably to a lot of others.) MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 ***To reply, remove "bogon" from the domain name.*** Visit my web page at: http://www.mcondic.com/