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: <40BDBBFA.2020203@noplace.com> <1087475285.166449@master.nyc.kbcfp.com> <2jlepqF12qbb6U1@uni-berlin.de> <1774424.VSnnNmZCKX@linux1.krischik.com> From: Brian May X-Home-Page: http://snoopy.apana.org.au/~bam/ Date: Wed, 23 Jun 2004 14:31:27 +1000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:xo7WQi3X7EvD1ZgQrLNeH2Zak/U= 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 1087965087 202.173.153.89 (23 Jun 2004 14:31:27 +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!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!c03.atl99!news.usenetserver.com!news02.tsnz.net!newsfeed01.tsnz.net!news.xtra.co.nz!news.mel.connect.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:1798 Date: 2004-06-23T14:31:27+10:00 List-Id: There seem to be two proposed solutions for the problem of passing information from exceptions: >>>>> "Martin" == Martin Krischik writes: Martin> Store them in an booch component map indexed by thread Martin> id. I do that in AdaCL.Trace. >>>>> "tmoran" == tmoran writes: 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; Again, both solutions don't feel "right" to me, they seem more work arounds rather then proper solutions. For example, if you use the string encoding method to encode a pointer (and do it in a type safe manner), in order to work around the maximum string limits, this means you have to allocate the memory first, or use a global buffer that is of fixed length and could be overwritten. Similarly, the booch component model no doubt will require allocation of additional memory, too. But what if the exception that is being processed is of a direct result of a out of memory error? (obviously I am assuming this is on some system, eg. embedded systems, that detects out of memory errors before it is too late). Even if it isn't the out of memory exception itself, a program may need to throw a new exception in response to an out of memory error. No doubt multiple threads may get out of memory errors simultaneously too, as they probably are sharing the same memory pool. (disclaimer: I am assuming, and would hope, that throwing an exception doesn't require allocating memory, otherwise disregard the above paragraph). The above solutions seem to make a simple task complicated; you wouldn't consider passing parameters to functions, procedures, or tasks by encoding them to strings or storing them in a global component container, so why should exceptions be any different? Sidenote: I seem to remember that there is a good review of the limitations of exception handling in Ada in the following reference: Author: Burns, Alan, 1953- Title: Real-time systems and programming languages : Ada 95, real-time Java, and real-time POSIX / Alan Burns and Andy Wellings. 3rd ed. Publisher: Harlow ; New York : Pearson Education, 2001. Description: xvi, 738 p. : In this book, Ada gets a pretty good rating, but falls down with exception handling, and the author lists his reasons, one of them being this one discussed. It seems to be a pretty good book overall, which makes comparisons between a number of languages. Unfortunately I don't have the book handy right now (it is a library book), so I can't cite from it. -- Brian May