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=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,820de86ed0dafb8a X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Help Me Please :) Date: 2000/03/28 Message-ID: <8bp2b8$e7u$1@nnrp1.deja.com>#1/1 X-Deja-AN: 603206793 References: <89rlvr$gn9$1@nntp3.atl.mindspring.net> <38D8A607.F61F0FFF@mail.com> X-Http-Proxy: 1.0 x42.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Mar 28 01:36:41 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-03-28T00:00:00+00:00 List-Id: In article , Robert A Duff wrote: > There's no hierarchy of exceptions. I dislike complexification of exception handling. Many Ada programmers greatly overuse exceptions, and in particular define far too many separate exceptions. When it comes to exception handling, the rule should be keep it very simple. > (On the other hand, Ada *pretends* that it's OK to raise and > handle Constraint_Error, but if you read RM-11.6, you'll find > that's not quite true -- and I doubt if any Ada programmer > other than Tucker Taft actually *understands* 11.6. So in > practise, 11.6 says, "Do not handle predefined exceptions.") Now now, that's completely disconnected from the real world :-) "In practice", 11.6 says nothing of the sort at all. It is often useful to be able to handle constraint error. For example here is the implementation of one of the plus operators in Calendar in GNAT: function "+" (Left : Time; Right : Duration) return Time is pragma Unsuppress (Overflow_Check); begin return (Left + Time (Right)); exception when Constraint_Error => raise Time_Error; end "+"; If you don't understand 11.6, at least don't make claims about it that are excessive :-) Sure, the formulation of 11.6 is complex, but you have to approach this with a pragmatist's hat on, not a theoretician's viewpoint. In practice many many Ada 95 programs have CE handlers and are in practice perfectly portable. Even if in some cases a theoretician could prove that it was possible to have an implementation of Ada 95 that conformed to the RM under which the handler is "wrong", that is irrelevant if no such implementations exist or are likely to exist. In other cases, even the theoretician's will not find any fault with the CE handler :-) Yes, Bob, I know you like to have the hope that the Ada RM is a formal definition which precisely defines what you can and cannot do. It is nowhere near that for many reasons, and a pragmatic viewpoint always has to be in effect. Sent via Deja.com http://www.deja.com/ Before you buy.