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!news4.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Exceptions Date: Tue, 11 Dec 2007 18:10:06 -0600 Organization: Jacob's private Usenet server 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: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1197572244 4072 69.95.181.76 (13 Dec 2007 18:57:24 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 13 Dec 2007 18:57:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:18925 Date: 2007-12-11T18:10:06-06:00 List-Id: "Robert A Duff" wrote in message news:wccr6ht5ki4.fsf@shell01.TheWorld.com... ... > 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. I don't buy the supposed need for two kinds of exceptions. It seems to me to be an implicit recognition of the fact that the contracts aren't sufficiently useful for many kinds of subprograms. I think it would be better to fix the capability of the contracts (if that's possible) than to define a trivial way to avoid them. Once you have unchecked exceptions, the contract really doesn't tell you anything interesting (since it is the propagation of predefined exceptions that usually lead to bugs; only the rare case where the predefined exception is caught will tell you anything at all). Moreover, the temptation is overwhelming to use the unchecked kind everywhere, because it is less hassle and the checked kind doesn't buy that much anyway (it doesn't guarentee that all exceptions are handled, but only the rare few that are declared checked). It's much like the accessibility rules in Ada. They're immensely complicated, yet their original primary goal is completely ignored. I've never yet found an Ada program where I could use 'Access on an object; I don't even bother trying anymore. So why have all of that complication? (Yes, I know its useful for subprograms and tagged types, and we can't avoid it there.) Randy. I vie