comp.lang.ada
 help / color / mirror / Atom feed
From: David Morton <dmorton@jinx.sckans.edu>
Subject: Re: Exceptions:  Are they GOTOs?
Date: 1996/07/12
Date: 1996-07-12T00:00:00+00:00	[thread overview]
Message-ID: <31E64A1F.281DE7A9@jinx.sckans.edu> (raw)
In-Reply-To: 4s4tgs$po6@masala.cc.uh.edu


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...




  reply	other threads:[~1996-07-12  0:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-11  0:00 Exceptions: Are they GOTOs? Bradley Edelman
1996-07-11  0:00 ` Michel Gauthier
1996-07-11  0:00 ` Robert A Duff
1996-07-12  0:00 ` steved
1996-07-13  0:00   ` Michael Feldman
1996-07-16  0:00   ` Robert I. Eachus
1996-07-19  0:00     ` Michel Gauthier
1996-07-18  0:00   ` Robert Dunn
1996-07-18  0:00     ` Robert Dewar
1996-07-19  0:00       ` Larry J. Elmore
1996-07-20  0:00         ` Andy Askey
1996-07-12  0:00 ` Spasmo
1996-07-12  0:00   ` David Morton [this message]
1996-07-14  0:00   ` Robert Dewar
1996-07-17  0:00     ` Spasmo
1996-07-18  0:00       ` Walter B. Hollman Sr.
1996-07-20  0:00         ` Robert Dewar
1996-07-13  0:00 ` Robert Dewar
1996-07-14  0:00 ` Andy Askey
1996-07-14  0:00   ` Laurent Guerby
1996-07-15  0:00     ` Andy Askey
1996-07-15  0:00       ` Robert Dewar
1996-07-14  0:00   ` Robert Dewar
1996-07-15  0:00 ` OS2 User
1996-07-16  0:00 ` Michel Gauthier
1996-07-17  0:00 ` Michel Gauthier
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox