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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1901f265c928a511 X-Google-Attributes: gid103376,public Newsgroups: comp.lang.ada Subject: Re: new revision ada References: From: Brian May X-Home-Page: http://snoopy.apana.org.au/~bam/ Date: Tue, 22 Jun 2004 09:33:29 +1000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:JSjI6rihLYYvWHZHVjW/X5fD/fM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: dsl-202-173-153-89.vic.westnet.com.au X-Trace: news.melbourne.pipenetworks.com 1087860809 202.173.153.89 (22 Jun 2004 09:33:29 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.mel.connect.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:1753 Date: 2004-06-22T09:33:29+10:00 List-Id: >>>>> "tmoran" == tmoran writes: >> ... and can pass more information in the >> exception instead of just a string). tmoran> I don't understand why this is considered a problem. Why not make: tmoran> type data_to_pass is record ... tmoran> function enstring(x : data_to_pass) return string; tmoran> function destring(s : string) return data_to_pass; That seems like a very ugly hack. Isn't the philosophy behind Ada that you specify what you want to happen, not how it happens? If you have to mangulate exception information into a string (whatever encoding you choose to use, you could use XML or you could use something else) in order to pass it to an exception, I think it has hardly succeeded. I have always thought of the text string to be a string to log/show the user, not one for processing internally by the application. Thats also a lot of overhead just to pass variables from one part of the program to another part of the same program, too. If you want to try to recover from an error condition (as opposed to simply displaying/logging an error and failing) you often need to have detailed information on what was going on when the error occurred. eg. ENGINE_FAILED(Number=>1, RPM=>xxxx, Occurred=>After_Switching_Fuel_Tanks) is a lot more informative then ENGINE_FAILURE and allows some sort of recovery process (eg. switch back to the previous fuel tank) instead of trying to guess information that was already known. (disclaimer: I haven't written such an application...) The solution I have heard of for Ada is to use global variables, but this is not a thread safe solution, you risk one thread overwriting the exception information of another thread. eg. in the above example, multiple threads might detect that multiple engines have failed simultaneously. -- Brian May