comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nick.roberts@acm.org>
Subject: Re: new revision ada (exception handling)
Date: Tue, 22 Jun 2004 17:09:23 +0100
Date: 2004-06-22T17:09:23+01:00	[thread overview]
Message-ID: <2jr3tjF149hg2U1@uni-berlin.de> (raw)
In-Reply-To: 1774424.VSnnNmZCKX@linux1.krischik.com

"Martin Krischik" <krischik@users.sourceforge.net> wrote in message
news:1774424.VSnnNmZCKX@linux1.krischik.com...

> > Your solution detaches the information from the notification.
> > This detachment causes problems, which are compounded by
> > concurrency. If two exceptions are raised in a program and
> > their state information is stored in some buffer such as
> > a protected object, how will a handler determine which state
> > belongs to which exception occurrence?
>
> Store them in an booch component map indexed by thread id.
> I do that in AdaCL.Trace.

I am intrigued by this technique. It is of importance to me, since I am
currently thinking about how to implement exception handling according to
the current CORBA Ada binding.

There seem to be two problems with the solution you suggest:

(1) Nested exception occurrances. If an exception is raised and handled
within an exception handler, the parameters of the outer occurrance will be
overwritten by those of the inner one. A solution would be for every handler
(that uses parameters) to copy off the parameters before doing anything else
(that could raise and handle an exception). However, this solution causes
extra work, and is not neat; it seems bug-prone to me.

(2) Memory management. The memory used up by the parameters of an exception
will not be reclaimed at an appropriate time (for example, when there is no
longer any possibility of the associated exception being handled). This is
only a memory leakage problem, and may be considered of low significance,
but I don't like it.

In addition, the use of a map structure seems a bit heavyweight.

I'd appreciate your comments.

> Again: why XML when Ada has a perfectly usable system to
> stream out data. i.E. 'Input and 'Output. Annex E is already
> based on it so it could be used for extended exceptions as
> well.

I think a possible answer to this question is that XML is human-readable (or
at least it is pure text), whereas Ada streams are (essentially) binary. I
think the point of providing (only) string data for parametising exceptions
in Ada 95 was to ensure that those parameters could simply be
printed/displayed (by diagnostic software). XML encoded parameters could
also be simply printed out, as well as being interpreted and used by
knowledgeable software.

However, I would not personally advocate this approach. The use of XML seems
extremely heavyweight to me. I think a better idea would be to allow
parameters to be added to an exception occurrance in the machine's internal
format (possibly as a value of a type derived from an abstract root tagged
type), in addition to an appropriate human-readable message being added to
the occurrance's message. This way, diagnostic software can simply print the
message, and knowledgable software can interpret the parameters directly.
There would be no need for any endcoding or decoding software. Surely having
to add an XML generator and parser to a piece of (embedded) software just to
support exception handling would be overkill?

-- 
Nick Roberts





  reply	other threads:[~2004-06-22 16:09 UTC|newest]

Thread overview: 66+ 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                             ` Nick Roberts [this message]
2004-06-23  7:55                               ` new revision ada (exception handling) 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                             ` new revision ada Brian May
2004-06-23 19:47                               ` 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
  -- strict thread matches above, loose matches on Subject: below --
2004-06-25  9:48 new revision ada (exception handling) Christoph Karl Walter Grein
replies disabled

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