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,LOTS_OF_MONEY autolearn=ham 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!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Exceptions Date: Tue, 11 Dec 2007 10:17:07 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5947aa62-2547-4fbb-bc46-1111b4a0dcc9@x69g2000hsx.googlegroups.com> <475c6ed8$0$13111$9b4e6d93@newsspool2.arcor-online.net> <1kxk3hlfa25dw$.fl2wvbn0tpbg$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1197386227 7841 192.74.137.71 (11 Dec 2007 15:17:07 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 11 Dec 2007 15:17:07 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:2mEhBxbV+B2Vsq67e841Pp+tS4Y= Xref: g2news1.google.com comp.lang.ada:18897 Date: 2007-12-11T10:17:07-05:00 List-Id: "Randy Brukardt" writes: > "Dmitry A. Kazakov" wrote in message >> 2. How often does a caller "eat" an exception of the callee instead of >> propagating it further? My guess is 1 / 10. > > This I agree with, and it is my primary objection to exception contracts. > This means that you'll have to write long-winded handlers and/or contracts > on 9/10 of the calls. ... This 1/10 number seems to be a guess at some sort of average (as in "mean"). I think it's misleading for the same reason it's misleading to say "The average income in so-and-so town is $1,000,000 per year". It might mean everybody's well off, or it might mean there's one super-rich guy, and everybody else in that town is starving. I think there are two kinds of exceptions: one that is handled approximately 1 level up the call chain, and the other that is handled way far up the call chain (near the main program, or not at all -- "not at all" = "by the Ada RTS"). The former kind is the one that might benefit from exception contracts. For the latter kind, one would use unchecked exceptions. Thus there is never a case where you are "forced" to mention the same exception all the way up 10 levels. Note that if you have a checked exception, and it really should be an unchecked one for some particular client, that client can turn it into an unchecked exception at that level, with no need to mention it in the next 9 levels. - Bob