From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Forcing Exception Handling
Date: Tue, 1 Mar 2011 16:44:01 +0100
Date: 2011-03-01T16:44:01+01:00 [thread overview]
Message-ID: <bunlf0afrf7b.1kvratii443ie.dlg@40tude.net> (raw)
In-Reply-To: fa1a4004-b346-46f7-b8a0-e32af90ae455@o21g2000prh.googlegroups.com
On Tue, 1 Mar 2011 07:23:56 -0800 (PST), Shark8 wrote:
> On Mar 1, 1:56�am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>>
>> Also consider this:
>>
>> � �declare
>> � � � Foo : exception:
>> � �begin
>> � � � ...
>> � � � raise Foo;
>> � �end; �-- Foo propagates out its scope!!
>>
>
> What's wrong with handling it with OTHERS?
You have an object of non-existent type:
when Error : others =>
Assuming that Error is of Root_Exception_Type'Class, what should Error'Tag
return?
>> A possibility to handle this is exception promotion, e.g. Foo to
>> Program_Error, when Foo gets finalized.
>
> A third is to convert Exceptions to a hierarchy as stated in my last
> post.
No, that does not work, because the exception type would be dead in the
handler. C++ model cannot work in Ada 2005+, because in Ada tagged types
can be local.
Further problems are overlapping choices in the exception clause. If the
semantics of
exception
when X =>
when Y =>
is dispatching on the tag of the current exception, which people suggesting
class-wide exceptions have in mind. Then that would be incompatible with
the choice
when others =>
which has the semantics of a class-wide call. If you choose that semantics
instead, then you would have to write
exception
when X'Class =>
when Y'Class =>
and lose the property that alternatives do not overlap. That is way
unacceptable to me.
These are the reasons why I don't think that exception -> type mapping is
such a good idea. I prefer exception -> value mapping + contracts.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2011-03-01 15:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 17:27 Forcing Exception Handling iloAda
2011-02-28 17:32 ` Simon Clubley
2011-02-28 18:33 ` onox
2011-02-28 19:10 ` Simon Clubley
2011-02-28 18:34 ` Vinzent Hoefler
2011-02-28 20:20 ` Florian Weimer
2011-02-28 20:35 ` Ludovic Brenta
2011-03-01 3:54 ` Randy Brukardt
2011-03-01 8:34 ` Dmitry A. Kazakov
2011-03-02 0:00 ` Randy Brukardt
2011-03-02 8:28 ` Dmitry A. Kazakov
2011-02-28 20:38 ` Georg Bauhaus
2011-03-01 0:19 ` Shark8
2011-03-01 8:56 ` Dmitry A. Kazakov
2011-03-01 9:34 ` iloAda
2011-03-01 9:47 ` Vinzent Hoefler
2011-03-01 9:51 ` Dmitry A. Kazakov
2011-03-01 10:07 ` iloAda
2011-03-01 13:27 ` Mark Lorenzen
2011-03-01 16:11 ` J-P. Rosen
2011-03-02 0:11 ` Randy Brukardt
2011-03-01 15:23 ` Shark8
2011-03-01 15:44 ` Dmitry A. Kazakov [this message]
2011-03-02 0:02 ` Randy Brukardt
2011-03-01 2:08 ` Hoàng Đình Long
2011-03-02 13:39 ` ytomino
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox