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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!igor!rutabaga!jls From: jls@rutabaga.Rational.COM (Jim Showalter) Newsgroups: comp.lang.ada Subject: Re: Pre-condition vs. Post-condition Keywords: pre-condition, post-condition, exception Message-ID: Date: 19 Mar 91 21:07:17 GMT References: <344@platypus.uofs.edu> <2865@sparko.gwu.edu> <97779@tut.cis.ohio-state.edu> <311@nic.cerf.net> Sender: news@Rational.COM List-Id: >Reaching the end-of-file or trying to POP off an >empty stack are NOT exceptional conditions. How to you justify this? Exceptions protect clients from incorrect algorithmic implementation. If a client attempts to read past end of file or pop past empty stack, it should be notified of the fact, since the client is in error. Other mechanisms (e.g. status flags) must be checked by the client to be effective (polling model), whereas exceptions cannot be overlooked (interrupt model). Thus, exceptions are more fail-safe. You also say that you don't think an exception should ever be raised after a system is delivered. I don't see how you can meet this constraint. For example, consider interaction with a user, a la Enumeration_Io. If the user enters bogus data--which you have no control over from within the program--an exception will be raised. This is not only unavoidable, but seems desirable to me. -- ***** DISCLAIMER: The opinions expressed herein are my own. Duh. Like you'd ever be able to find a company (or, for that matter, very many people) with opinions like mine. -- "When I want your opinion, I'll read it in your entrails."