From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Exception_Occurence and language designers
Date: Mon, 4 Dec 2017 15:31:26 +0100
Date: 2017-12-04T15:31:26+01:00 [thread overview]
Message-ID: <p03m7u$nip$1@gioia.aioe.org> (raw)
In-Reply-To: f8e70027-fc10-4412-b6a7-0c55ada9b4b5@googlegroups.com
On 04/12/2017 15:00, Mehdi Saada wrote:
> but an "exception" is also an exception that might happen, at least
> when it's just declared. I still wonder why the same subprograms can
> take both Exception_Identity and Exception_Occurence, but not objects
> of the mere "exception" type. Mere exceptions are declared, but never
> taken as parameters like normal type instances are, like instances
> of Exception_Identity are.
In Ada 83 exception was not a first-class type. When Ada 95 added
exception information it introduced Exception_Id to serve as a proper
type for a class of exceptions and Exception_Occurrence to serve as
exception instances.
In terms of tagged types it is like this:
exception type Foo : exception
class-wide exception type = Exception_Occurence
class-wide exception tag = Exception_Id
Error'Exception_Identity is similar to Object'Tag.
There is no type-specific exception handling because you cannot define
specific operations on an exception type:
Foo : exception;
procedure Bar (Error : Foo); -- This is illegal
You cannot declare type-specific exception instances either:
Error : Foo; -- This is illegal
You can only declare class-wide instances in the form of exception handler:
exception
when Error : Foo | Baz =>
or explicitly:
Error : Exception_Occurrence;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2017-12-04 14:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 11:17 Exception_Occurence and language designers Mehdi Saada
2017-12-04 12:32 ` Simon Wright
2017-12-04 14:00 ` Mehdi Saada
2017-12-04 14:31 ` Dmitry A. Kazakov [this message]
2017-12-04 20:27 ` G. B.
2017-12-04 20:55 ` Dmitry A. Kazakov
2017-12-05 0:16 ` G. B.
2017-12-05 8:35 ` Dmitry A. Kazakov
2017-12-05 20:05 ` G. B.
2017-12-05 20:48 ` Dmitry A. Kazakov
2017-12-04 17:43 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox