comp.lang.ada
 help / color / mirror / Atom feed
From: gauthier@unilim.fr (Michel Gauthier)
Subject: Re: Exceptions:  Are they GOTOs?
Date: 1996/07/11
Date: 1996-07-11T00:00:00+00:00	[thread overview]
Message-ID: <gauthier-1107961111450001@164.81.60.62> (raw)
In-Reply-To: brad.837052481@ss1



In article <brad.837052481@ss1>, brad@cs.uwa.oz.au (Bradley Edelman) 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.
>>  
>>  I think raising an exception is a neater way of handling an error than, say,
>>  returning an error code or status.
>>  
>>  I'd appreciate thoughts either way.

You might find a somewhat long answer in my book
"Ada, a professional course", published by Macmillan.
May I abstract it here ?

The main difference between exception raise and goto is that :
- raising an exception is essentially declarative : I assert that...
- goto'ing (rather than 'going to') is imperative : do this...

Exceptions are not a concept. The concept is 'reporting' 
that the required service could not be obtained.
Exceptions can implement reports, as well as any kind
of status code. Most of the problems come from reporting,
not from its implementation.

The main problem is not in goto nor in raise but in the lable or 
in the handling. It is caused by the multipleness of program 
flows that converge. Hence :
- the assertion is a disjunct, therefore weakened,
- generally, the programmer has only a partial knowledge of
   this set of arrows, and in fact knows nothing useful.

Additional thougths later, if requested.

----------          ----------          ----------          ---------- 
Michel Gauthier / Laboratoire d'informatique
123 avenue Albert Thomas / F-87060 Limoges
telephone +33 () 55457335 [or ~ 7232]
fax +33 ()  55457315  [or ~7201]
----------          ----------          ----------          ----------
La grande equation de la fin du siecle : windows-X = Mac-Y
The main end-of-century equation : windows-X = Mac-Y
----------          ----------          ----------          ----------
Si l'an 2000 est pour vous un mysticisme stupide, utilisez la base 9
If you feel year 2000 a stupid mystic craze, use numeration base 9
----------          ----------          ----------          ----------




  reply	other threads:[~1996-07-11  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 [this message]
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
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