From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,743cbb1eadac54f3 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: question on exceptions Date: 1996/11/03 Message-ID: #1/1 X-Deja-AN: 194123421 references: organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-11-03T00:00:00+00:00 List-Id: In article , Michiel Perdeck 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