comp.lang.ada
 help / color / mirror / Atom feed
From: Brian May <bam@snoopy.apana.org.au>
Subject: Re: new revision ada
Date: Wed, 23 Jun 2004 14:31:27 +1000
Date: 2004-06-23T14:31:27+10:00	[thread overview]
Message-ID: <sa4acyulwtc.fsf@snoopy.apana.org.au> (raw)
In-Reply-To: 1774424.VSnnNmZCKX@linux1.krischik.com

There seem to be two proposed solutions for the problem of passing
information from exceptions:

>>>>> "Martin" == Martin Krischik <krischik@users.sourceforge.net> writes:

    Martin> Store them in an booch component map indexed by thread
    Martin> id. I do that in AdaCL.Trace.


>>>>> "tmoran" == tmoran  <tmoran@acm.org> 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 <bam@snoopy.apana.org.au>



  parent reply	other threads:[~2004-06-23  4:31 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-31 13:32 Typing in Ada Empit
2004-05-31 14:04 ` Poul-Erik Andreasen
2004-05-31 17:01 ` Jeffrey Carter
2004-05-31 20:03   ` Peter C. Chapin
2004-05-31 22:56     ` tmoran
2004-06-01  1:09       ` Peter C. Chapin
2004-06-01  4:40         ` tmoran
2004-06-01 11:26           ` Peter C. Chapin
2004-06-10  3:01             ` Dave Thompson
2004-06-10  3:00         ` Dave Thompson
2004-05-31 23:22     ` Nick Roberts
2004-06-01  1:04       ` Peter C. Chapin
2004-06-01  2:29         ` Nick Roberts
2004-06-02  4:39         ` Robert I. Eachus
2004-06-02 15:17           ` Hyman Rosen
2004-06-01  2:36       ` Hyman Rosen
2004-06-01  4:27         ` Larry Kilgallen
2004-06-01  4:05           ` Hyman Rosen
     [not found]         ` <d4vnb0tepd4togdrvdrbqpok1ne6n9i2vp@4ax.com>
2004-06-01 14:36           ` Wes Groleau
2004-06-01 20:24         ` Niklas Holsti
2004-06-02  4:43           ` Wes Groleau
2004-06-02  5:28             ` Robert I. Eachus
2004-06-02  8:19               ` tmoran
2004-06-02 14:47               ` Wes Groleau
2004-06-02 11:26             ` Marin David Condic
2004-06-02 14:54               ` gratuitous restrictions (was:Typing in Ada) Wes Groleau
2004-06-02  5:04           ` Typing in Ada Robert I. Eachus
2004-06-01  2:14     ` David C. Hoos
2004-06-02  1:30     ` Jeffrey Carter
2004-06-02 10:53       ` Peter C. Chapin
2004-06-02 11:38         ` Marin David Condic
2004-06-17  2:50           ` Dave Thompson
2004-06-17  4:24             ` James Rogers
2004-06-17 12:28               ` Hyman Rosen
2004-06-17 23:42                 ` James Rogers
2004-06-20 11:27                   ` Nick Roberts
2004-06-20 23:29                     ` new revision ada Brian May
2004-06-21  2:16                       ` tmoran
2004-06-21  2:34                         ` James Rogers
2004-06-22  2:16                           ` Roland Illig
2004-06-22  3:41                             ` James Rogers
2004-06-22  6:53                               ` Martin Krischik
2004-06-21 23:33                         ` Brian May
2004-06-22 20:26                           ` Simon Wright
2004-06-23  0:50                             ` Larry Elmore
2004-06-22 22:06                           ` tmoran
2004-06-21  5:31                       ` Wes Groleau
2004-06-21 12:27                       ` new revision ada (limited with, excpetion handling) Nick Roberts
2004-06-21 13:04                         ` Martin Dowie
2004-06-22 10:38                       ` new revision ada Georg Bauhaus
2004-06-22 12:45                         ` James Rogers
2004-06-22 15:17                           ` Martin Krischik
2004-06-22 16:09                             ` new revision ada (exception handling) Nick Roberts
2004-06-23  7:55                               ` Pascal Obry
2004-06-23  8:40                                 ` Martin Krischik
2004-06-23 19:33                                   ` Randy Brukardt
2004-06-24  6:57                                     ` Martin Krischik
2004-06-24 21:13                                       ` Randy Brukardt
2004-06-25  8:05                                         ` Dmitry A. Kazakov
2004-06-25 17:28                                           ` Randy Brukardt
2004-06-23  4:31                             ` Brian May [this message]
2004-06-23 19:47                               ` new revision ada Randy Brukardt
2004-06-22 16:37                           ` Georg Bauhaus
2004-06-26 14:57                           ` Robert I. Eachus
2004-06-01  1:02 ` Typing in Ada Alexander E. Kopilovich
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox