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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc243f3bb85ffa4f X-Google-Attributes: gid103376,public From: David Morton Subject: Re: Exceptions: Are they GOTOs? Date: 1996/07/12 Message-ID: <31E64A1F.281DE7A9@jinx.sckans.edu>#1/1 X-Deja-AN: 167983894 references: <4s4tgs$po6@masala.cc.uh.edu> content-type: text/plain; charset=us-ascii organization: student mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; Linux 2.0.0 i486) Date: 1996-07-12T00:00:00+00:00 List-Id: Spasmo wrote: > > Bradley Edelman (brad@cs.uwa.oz.au) wrote: > : What do people think about exception handling? I believe it to be a major > : strength of Ada but there is a school of thought that exceptions are just > : GOTO statements and should be avoided accordingly. > > Well, exceptions IMO do seem to be a bit unstructured in that control > is immediately transferred to another block and everything is surpassed > so that the possible paths of execution may not be obvious, however > I think this is a very small price to pay for such a beautiful way of > handling errors. again, that is the nature of an exception... it may be a sort of goto in this case: procedure foo is Something : exception; begin raise something; other stuff... exception when something => oops; end foo; but, if the exception handler is not there, then this isn't a goto, because the exception propagates back down to the caller of this procedure. That would mean the stack values being popped, and any static variables being removed... right? exceptions are wonderful tools for handling an error. Like Spasmo said, it's a heck of a lot easier than trying to cram in another parameter or worse, having the calling prog not check for the error anyway... exceptions do ensure that something will be done about the error. -- David Morton mailto:dmorton@jinx.sckans.edu http://www.sckans.edu/~dmorton/ 205 College, Winfield, KS 67156 This signature will self-destruct in 10 seconds...