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-Thread: 103376,7d3cb5920e882220 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Exceptions Date: Sun, 09 Dec 2007 16:39:44 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5947aa62-2547-4fbb-bc46-1111b4a0dcc9@x69g2000hsx.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1197236384 11582 192.74.137.71 (9 Dec 2007 21:39:44 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 9 Dec 2007 21:39:44 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:FQj3nCQ+cjLyumgv03RH3qrrPdI= Xref: g2news1.google.com comp.lang.ada:18829 Date: 2007-12-09T16:39:44-05:00 List-Id: tmoran@acm.org writes: >>Is there any way to force programmers to catch exception that >>your function throws? > Do you mean force them to write code like: > begin > y := func(x); > exception > when funcs_important_exception=>null; -- ignore unimportant exception > end; I've heard that this is a common problem in Java code. Compiler complains, so the programmer puts in an exception-ignoring handler -- probably without any comment explaining why. But I don't get it. If you think a certain exception is impossible in a certain case, and the compiler insists on a handler, the obvious thing to do is raise an unchecked exception. In Ada: when Funcs_Important_Exception => -- raise Program_Error; Why on earth would anybody write "null;" there?! I don't blame the Java language design for this problem. - Bob