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: gauthier@unilim.fr (Michel Gauthier) Subject: Re: question on exceptions Date: 1996/11/04 Message-ID: #1/1 X-Deja-AN: 194698795 references: organization: Universite de Limoges newsgroups: comp.lang.ada Date: 1996-11-04T00:00:00+00:00 List-Id: In article , michiel.perdeck@cmg.nl wrote: >> [...] >> >> Questions: >> Unlike an exception in C++, an Ada exception cannot carry any >> extra information besides it's own name. [...] Ada _can_ do this : - directly, in the case of String values, - indirectly, for every type with functions similar to the Image and Value attributes. Attaching a String to a raise is a basic operation available in the Ada.Exceptions predefined package. For things other than String values, you can attach the Image of what you want to attach. Inside the exception handler, you can extract the message, and take its Value, which gets back the initial value. Caution : this works only if you can control that all raises are correctly attached. Therefore, either you restrict such uses to non-resusable parts, or you handle Constraint_Error possibly caused by the back-parsing of the message. ---------- ---------- ---------- ---------- Michel Gauthier / Laboratoire d'informatique 123 avenue Albert Thomas / F-87060 Limoges telephone + 33 () 05 55 45 73 35 [or ~ 72 32] fax +33 () 05 55 45 73 15 [or ~72 01] no initial zero from abroad ! ! ! ---------- ---------- ---------- ---------- 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 ---------- ---------- ---------- ----------