comp.lang.ada
 help / color / mirror / Atom feed
From: Warren <ve3wwg@gmail.com>
Subject: Re: Strategies with SPARK which does not support exceptions
Date: Mon, 21 Jun 2010 13:31:18 +0000 (UTC)
Date: 2010-06-21T13:31:18+00:00	[thread overview]
Message-ID: <Xns9D9E60DC6F348WarrensBlatherings@188.40.43.230> (raw)
In-Reply-To: op.vegih2owule2fv@garhos

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]

=?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= expounded in
news:op.vegih2owule2fv@garhos: 

> Le Thu, 17 Jun 2010 19:11:29 +0200, Warren <ve3wwg@gmail.com> a
> écrit: 
>> It is often not sufficient to simply know that OK is false.
>> For example, wouldn't it be nice for the user to know that
>> the open failed because of permissions, instead of the file
>> not existing.
>>
>> Warren

> I see what you mean (I like the C analogy for this, that is
> meaningful),  while I don't fully agree with this later point : an
> exception typically  do not holds such details. 

Agreed and I was not promoting exceptions per se (to start with,
they are clumsy in C (with longjmp) due to the need to intercept
and do your own "cleanup" (effectively destructors).

> The exception says
> “If fails”, and don't say  why (or just sightly, via its ID).
> Don't confuse Ada exception mechanism  with other OO exception
> mechanisms, which comes with many and too much  (because unusable in
> real life) members to hold informations about the  exception
> occurence. 

Exceptions are ok for things that rarely occur, IMO. In Ada they
can be convenient, but it depends upon your application. For
example, a Not_Found exception is sufficient for my use, if I am
looking up a symbol table (map container in a wrapper) and it 
does not exist. I realize that it can incur overhead, depending
upon build options.  This works because the invoking program
already has the context info (it knows the symbol it tried to
look up).

> By the way, you are talking about propagated exceptions (as you talked
>  about callers). I did not already set up a strategy for this. 

Like I said above, I was not really considering exceptions. 
But exceptions can be tricky if they unwind through several 
layers. For example, in my current project, I usually need to
intercept them to make sure that certain reference counts are
properly unreferenced.  This applies only to objects that do
not have a Finalize method.

..
> CPU status registers), but  I'm afraid this may not be safe (while
> luckily, SPARK can help a lot to  properly use global variables ;) ).

Does SPARK even permit exceptions? I'm too lazy to
look it up.

Warren



  reply	other threads:[~2010-06-21 13:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 15:33 Strategies with SPARK which does not support exceptions Yannick Duchêne (Hibou57)
2010-06-17 17:11 ` Warren
2010-06-17 18:19   ` Yannick Duchêne (Hibou57)
2010-06-21 13:31     ` Warren [this message]
2010-06-21 14:10       ` Alexandre K
2010-06-17 19:54 ` Pascal Obry
2010-06-17 22:47   ` Peter C. Chapin
2010-06-18  6:07 ` Claude
2010-06-18  8:06 ` Phil Thornley
2010-06-18  8:49   ` Martin
2010-06-18 17:16     ` mockturtle
2010-06-18 21:51       ` Alexandre K
2010-06-22 17:01   ` Phil Clayton
2010-06-22 23:14 ` Claude
2010-06-23 16:22   ` Warren
2010-06-24  3:24     ` Claude
2010-06-28 13:14       ` Warren
2010-06-29  8:39         ` Stephen Leake
2010-06-29 20:05       ` Randy Brukardt
2010-06-29 20:49         ` Georg Bauhaus
2010-06-30  5:08         ` Simon Wright
2010-06-30  8:17         ` stefan-lucks
replies disabled

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