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,820de86ed0dafb8a X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Help Me Please :) Date: 2000/03/17 Message-ID: #1/1 X-Deja-AN: 598861800 Sender: bobduff@world.std.com (Robert A Duff) References: <89rlvr$gn9$1@nntp3.atl.mindspring.net> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-03-17T00:00:00+00:00 List-Id: Richard D Riehle 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. 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. - Bob