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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7d3cb5920e882220 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Exceptions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <5947aa62-2547-4fbb-bc46-1111b4a0dcc9@x69g2000hsx.googlegroups.com> <475c6ed8$0$13111$9b4e6d93@newsspool2.arcor-online.net> Date: Mon, 10 Dec 2007 09:22:40 +0100 Message-ID: <1kxk3hlfa25dw$.fl2wvbn0tpbg$.dlg@40tude.net> NNTP-Posting-Date: 10 Dec 2007 09:14:57 CET NNTP-Posting-Host: 9b1a7c0c.newsspool4.arcor-online.net X-Trace: DXC=3`kgB7l1gY56`1:F X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:18848 Date: 2007-12-10T09:14:57+01:00 List-Id: On Sun, 09 Dec 2007 23:40:20 +0100, Georg Bauhaus wrote: > Robert A Duff wrote: >> I think there are some mistakes in the Java design for exceptions, but I >> don't think the whole idea of exception contracts is bad. >> > When Robert Dewar talked about exceptions at MIT (I think, that's > from memory of a video recording), one of his arguments was that > you don't want to write cascades of conditionals for handling > return values (being either returned values or failure indicators) > ---because that's a mess. > > Now, when we have a sequence of statements in a block, > > P1(X); P2(X); ... ; Pn(X, Y); > > then what will be the average number of exception handlers > for this block? Involving how many different exceptions? Close to 0. 1. How often do you declare a new exception when writing a new subprogram? My guess is about 1 / 10_000. 2. How often does a caller "eat" an exception of the callee instead of propagating it further? My guess is 1 / 10. There is not that many handlers in a good designed code. This is probably the reason why people forget to handle exceptions properly. They are not that visible. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de