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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-17 22:38:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail From: Charles Hixson Subject: Re: RISC Newsgroups: comp.lang.ada References: <98tt7g$88h$1@nh.pace.co.uk> Organization: Mandala Fluteworks User-Agent: KNode/0.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: Date: Sun, 18 Mar 2001 06:37:15 GMT NNTP-Posting-Host: 158.252.218.106 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 984897435 158.252.218.106 (Sat, 17 Mar 2001 22:37:15 PST) NNTP-Posting-Date: Sat, 17 Mar 2001 22:37:15 PST Xref: supernews.google.com comp.lang.ada:5822 Date: 2001-03-18T06:37:15+00:00 List-Id: Robert A Duff wrote: > "Marin David Condic" writes: > >> Its hard to come up with absolute rules since it often requires >> subjective, artistic judgements. Just keep in mind that the intention is >> to have a mechanism that deals with *errors* - not anticipated conditions >> that can be accommodated with some sort of "normal" processing. > >.... > Another way to look at it is that the point of exceptions is to separate > the code that *detects* errors from the code that *handles* those > situations. If the code that detects something knows what to do about > it, then exceptions aren't necessary -- that code can just have an 'if' > statement that checks the condition, and handles the situation in the > 'then' part. > > - Bob > Is the problem that exceptions are expensive, or that exceptions violate localization? Or something else? E.g.: Should EOF detection be done with an exception? It's usuaual, but expected. I think of encountering an EOF and an unusual condition, and it's nice to be able to automatically check for it whenever a read happens without explicitly calling on an eof() function. Java rather expects that procedures will throw exceptions. I don't know C++ well enough to comment. Python seems to believe that exceptions are quite reasonable. Eiffel thinks that exceptions should be handled within the same routine that defines them. Etc. I think that this is a language specific issue. My impression was that Ada exceptions were intended to handle unusual cases (exceptional cases). That they were slightly more expensive to raise than a local branch would be, but that they were slightly cheaper if no exceptional case was detected. And that they should be handled as close to the routine that raised them as possible. Preferably within the routine. But I would hardly call myself an expert at Ada.