comp.lang.ada
 help / color / mirror / Atom feed
From: Richard D Riehle <laoXhai@ix.netcom.com>
Subject: Re: Help Me Please :)
Date: 2000/03/18
Date: 2000-03-18T18:39:47+00:00	[thread overview]
Message-ID: <8b0ihj$sli$1@nntp9.atl.mindspring.net> (raw)
In-Reply-To: wccog8dqvk6.fsf@world.std.com

In article <wccog8dqvk6.fsf@world.std.com>,
	Robert A Duff <bobduff@world.std.com> wrote:

>Richard D Riehle <laoXhai@ix.netcom.com> writes:
>
>> In some languages, exceptions are first class objects.  
>> Ada exceptions are not first class objects for very good reasons.
>                                                 ^^^^^^^^^^^^^^^^^
>>I beg to differ.  I think this is one of the few cases where those other
>languages got it right, and Ada got it wrong.

Delighted to have this response from you.  I have been spending some
time with C++ lately and find the exception model to be confusing,
error-prone, and more complicated than necessary.  One reason I like
the Ada model is its simplicity compared to other languages.  We
can agree to disagree on this.  

>If you want strings, Ada.Exceptions works OK (although it's annoying to
>have "exceptions" and "Exception_Ids", which are both essentially
>representations of the same concept).  If you want to attach some other
>type of data to an exception, you're stuck with several poor
>alternatives: You could encode that data as a String, but then you lose
>type checking -- the declaration of an exception ought to declare the
>type of attached data, forming a compile-time-checkable contract between
>the raise point and the handler point.  Or you could store the
>information in a global, but then you lose task safety, and there are
>issues of exactly when that global data is valid.  Etc.

For embedded systems, one does not want to be, in the words of Dr.
Tokar of DDC-I, ..."passing strings all over the place."  Also, 
for non-embedded systems, not all compilers adequately support 
the facilities of Ada.Exceptions, especially.  Janus and ObjectAda
have pretty good support for the function, Exception_Information,
but some others do not.  

The reason for promoting an exception to a typed value has to be 
compelling.  Consequently, it is rarely necessary.  In an application
such as a non-stop command and control system, one could find compelling
reasons for wrapping an exception_occurrence in a tagged type and
referring to it during some lull in activity as part of a logging
operation.  There are other circumstances when promoting an 
exception to a first-class object might be compelling.  

In the absence of such compelling circumstances, insisting that an 
exception be a first-class object simply complicates the entire
exception handling process.  The Ada solution, which provides the
option of promoting it to a first-class object, seems to me the
optimal solution.  

Thanks for you insight on this.  I beleive it is an important thread
of discussion about Ada, one we do not visit often enough.  

Richard Riehle
richard@adaworks.com
 




  parent reply	other threads:[~2000-03-18  0:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-29  0:00 Help Me Please :) Will Mann
2000-03-01  0:00 ` Robert Dewar
2000-03-03  0:00   ` Florian Weimer
2000-03-03  0:00     ` tmoran
2000-03-04  0:00       ` Richard D Riehle
2000-03-05  0:00         ` Steve Arnold
2000-03-17  0:00         ` Robert A Duff
2000-03-18  0:00           ` James S. Rogers
2000-03-19  0:00             ` Robert A Duff
2000-03-20  0:00               ` Brian Rogoff
2000-03-20  0:00                 ` Tucker Taft
2000-03-18  0:00           ` Richard D Riehle [this message]
2000-03-20  0:00           ` Florian Weimer
2000-03-22  0:00           ` Mats Weber
2000-03-27  0:00             ` Robert A Duff
2000-03-27  0:00               ` Hyman Rosen
2000-03-28  0:00               ` Robert Dewar
2000-03-30  0:00                 ` Mats Weber
2000-04-06  0:00                   ` Exceptions (was: " Wes Groleau
2000-04-07  0:00                     ` Mats Weber
2000-03-28  0:00               ` reason67
2000-03-28  0:00                 ` Robert Dewar
2000-03-29  0:00                   ` reason67
2000-03-29  0:00                   ` Simon Wright
2000-04-06  0:00                   ` Simon Pilgrim
2000-04-07  0:00                     ` Robert Dewar
2000-04-10  0:00                       ` r_c_chapman
2000-03-29  0:00               ` Richard D Riehle
2000-03-29  0:00                 ` Robert Dewar
2000-03-31  0:00                   ` Richard D Riehle
2000-03-31  0:00                     ` Jean-Pierre Rosen
2000-03-31  0:00                       ` Pascal Obry
2000-03-30  0:00                 ` Mats Weber
2000-03-31  0:00                   ` Richard D Riehle
2000-04-06  0:00                 ` Wes Groleau
2000-03-30  0:00               ` Mats Weber
2000-03-30  0:00               ` Tucker Taft
     [not found]     ` <2000Mar3.183321.69279@ludens>
2000-03-03  0:00       ` Larry Kilgallen
2000-03-04  0:00       ` Robert Dewar
     [not found] <df481109.0106140310.5d923746@posting.google.com>
     [not found] ` <9gb1uu$87u7o$1@ID-52877.news.dfncis.de>
2001-06-19  2:59   ` help me please! Ken Garlington
2001-06-16 10:20     ` C.D.Damron
2001-06-20  6:06     ` John Keeney
  -- strict thread matches above, loose matches on Subject: below --
2000-02-29  0:00 Help Me Please :) Will Mann
2000-02-29  0:00 ` Stanley R. Allen
2000-02-29  0:00   ` Al Johnston
2000-03-01  0:00     ` Robert Dewar
2000-03-01  0:00     ` Robert Dewar
2000-03-01  0:00       ` Al Johnston
2000-03-01  0:00     ` Stanley R. Allen
2000-03-01  0:00     ` tmoran
2000-03-01  0:00       ` Al Johnston
2000-03-02  0:00       ` Aidan Skinner
2000-03-01  0:00 ` James Bean
2000-03-01  0:00 ` tmoran
replies disabled

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