comp.lang.ada
 help / color / mirror / Atom feed
From: cosc19z5@Bayou.UH.EDU (Spasmo)
Subject: Re: Exceptions:  Are they GOTOs?
Date: 1996/07/12
Date: 1996-07-12T00:00:00+00:00	[thread overview]
Message-ID: <4s4tgs$po6@masala.cc.uh.edu> (raw)
In-Reply-To: brad.837052481@ss1


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.


: I think raising an exception is a neater way of handling an error than, say,
: returning an error code or status.

Full agreement.  There are 2 really great things that I love about
exceptions.
	1) They don't interfere with the regular return mechanisms of
	   subprogram units.  This was something that annoyed me to no
	   end in other languages.  If I had to account for error
	   returns, I'd have to cram it in with the other parameters or
	   return type of my subprogram which would play havoc with my
	   design, and often convolute things.  Furthermore there was
	   another problem which I'll talk about in #2.

	2) You can't ignore exceptions, and this is great because you
	   know that if you raise an exception, it WILL be handled.
	   Either the programmer on the other end will handle it, or
	   the system will take over, which will make the programmer
	   realize that there's an important return that he/she should
	   handle.  If you returned values from a procedure/function
	   then you had to face the possibility of your error code
	   being ignored.  This is especially serious in C/C++ since you
	   can happily ignore the return values from functions entirely,
	   calling them instead as if they were void functions.


: I'd appreciate thoughts either way.

All I can say is that I *LOVE* Ada's exceptions.  Hell, I like a lot
about Ada, but this is a thread about exceptions so I won't babble
here :)


: Thanks, Brad

--
Spasmo
"Here's a present just for you
When you open it, you'll be through"
	"Letter Bomb" by the Circle Jerks





  parent 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 [this message]
1996-07-12  0:00   ` David Morton
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