comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: question on exceptions
Date: 1996/11/03
Date: 1996-11-03T00:00:00+00:00	[thread overview]
Message-ID: <E0B70y.CFJ@world.std.com> (raw)
In-Reply-To: E090uD.Kx6@tip.nl


In article <E090uD.Kx6@tip.nl>, Michiel Perdeck <michiel.perdeck@cmg.nl> wrote:
>    Unlike an exception in C++, an Ada exception cannot carry any
>extra information besides it's own name.

Not true.  In Ada 95, an exception can carry some string information.
Look at package Ada.Exceptions.

>... In C++ you can have an
>exception of a certain class e.g. SQL_Exception, and then put a
>message in an exception when it occurs. The exception handler can then
>use that information to write on a log-file or the like. It seems to
>me that this is a more flexible concept (exceptions as objects) than
>that of Ada (exceptions as scalar types).

I agree that the C++ way (which also exists in many other languages,
such as Java, CLOS, CLU (I think?)), is better, because Ada restricts
this information to be of type String.  Also, these other languages
allow an exception handler to decide how finely to control the handling
-- handle all sorts of I/O errors, or just handle the file-not-found
error -- whereas in Ada, this decision must be made at the point of the
exception declaration(s).  Also, two kinds of things are needed in Ada
(exceptions and Exception_Id's), where one would suffice.  IMHO, that's
an ugly hack.

On the other hand, type String is often good enough -- your example of a
log file is easy to do in Ada.

>I hope you can convince me that I'm wrong! What do you think?

You're partly wrong.  ;-)

- Bob




  reply	other threads:[~1996-11-03  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-02  0:00 question on exceptions Michiel Perdeck
1996-11-03  0:00 ` Robert A Duff [this message]
1996-11-03  0:00 ` Laurent Guerby
1996-11-04  0:00   ` Do-While Jones
1996-11-06  0:00     ` Robert A Duff
1996-11-07  0:00       ` Tucker Taft
1996-11-08  0:00         ` Robert A Duff
1996-11-08  0:00       ` Robert Dewar
1996-11-09  0:00         ` Tucker Taft
     [not found]           ` <E0Mr58.D00@world.std.com>
1996-11-09  0:00             ` Robert Dewar
1996-11-04  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