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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Help understanding the benefits of Ada's exception model Date: Thu, 26 Jun 2014 09:08:01 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 26 Jun 2014 16:08:03 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="ba346f17b503f6aa8ecbfd6d1e2a9f59"; logging-data="1667"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wQM4E0KTJSnybi2rzS/biETXFH7UBNmg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Cancel-Lock: sha1:f66DOeTpf6RGi50g9RNVWJGLhnA= Xref: news.eternal-september.org comp.lang.ada:20620 Date: 2014-06-26T09:08:01-07:00 List-Id: On 06/26/2014 07:28 AM, Patrick wrote: > Sorry for answering my own post. I think I have not used the terms unchecked > exception and check exceptions properly. Better terms would be handling > exceptions and handling error codes. The pitfalls of relying on error codes are well documented, the most obvious being the numerous cases where they're not checked. An exception cannot be ignored. What is ideal is code that offers a check to avoid causing the exception, while raising the exception if the check is not used: if not Stack.Is_Empty then Stack.Pop (Item => V); -- Use V end if; but Stack.Pop (Item => V); -- raises Empty if Stack.Is_Empty -- Jeff Carter "Many times we're given rhymes that are quite unsingable." Monty Python and the Holy Grail 57