Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!.POSTED!not-for-mail From: Willem Newsgroups: comp.programming Subject: Re: etiology of exceptions Date: Tue, 25 Sep 2012 20:51:56 +0000 (UTC) Organization: Stack Usenet News Service Lines: 46 Message-ID: References: NNTP-Posting-Host: turtle.stack.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: mud.stack.nl 1348606316 82269 2001:610:1108:5010::132 (25 Sep 2012 20:51:56 GMT) X-Complaints-To: abuse@stack.nl NNTP-Posting-Date: Tue, 25 Sep 2012 20:51:56 +0000 (UTC) User-Agent: slrn/0.9.9p1 (FreeBSD) Xref: csiph.com comp.programming:2246 Daniel Pitts wrote: ) On 9/25/12 7:29 AM, bob wrote: )> What is the etiology of exceptions? Did they come about because people )> got tired of having to check a return value every time they called a )> function? )> ) I don't know of how they came to be, but I can list several benefits. ) ) 1. The Error Condition and the Error Handler which-could-handle-it were ) often separated by several levels of calls. ) ) 2. Having a "magic" return value isn't always possible, or desirable, so ) some other mechanism needed to be employed. Passing an argument by ) reference has additional overhead for a hopefully rare case. ) ) 3. In some languages, Exceptions can be compile-time checked, which ) helps reduce the number of bugs. The compiler can even use its typing ) system to ensure that the *correct* exceptions are handled, further ) reducing human error. ) ) 4. Exceptions also allow easy polymorphism of error cases. Because of ) this, they are useful in more OO design patterns over simple return values. ) ) 5. In complicated programs, it is easier to visualize flow of execution ) with fewer "if" statements. Using exceptions allows easier ) understanding of the "normal" flow vs "exceptional" flow. It also helps ) to understand what code is actually responsible for handling error ) conditions (since its concentrated in the catch blocks). ) ) This is all just off the top of my head, and some of it may be arguable, ) but IMHO the argument that you can just check return values is flawed. ) You *can* just check return values, just as you *can* turn off a ) light-bulb by unscrewing it. There just is a better way. Those are good reasons to have exception checking, but none of that answers the question. What the OP wants to know is what was the birth of exception checking. What is the history, how did it come about, etc. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT