comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: making a son benefit access ton an instanciation of a generic package required as a formal parameter to his father and instanciated by him
Date: Mon, 22 Jan 2018 09:25:11 +0000
Date: 2018-01-22T09:25:11+00:00	[thread overview]
Message-ID: <lyd1221c08.fsf@pushface.org> (raw)
In-Reply-To: p447b4$tg2$1@gioia.aioe.org

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On 22/01/2018 00:07, Mehdi Saada wrote:

>> An exception is declared in an package, P1, instance of P1_G, and
>> the RM says I can't use it in a handler... why so ?
>
> No, it does not say so. As Jeffrey already explained, generic package
> is not a package. An exception declared in a generic package is not an
> exception until the package is instantiated. You cannot reference to
> that fake exception as a normal one.

The message we get is

   generics.ada:17:10: exception "Ex0" is declared in generic formal package
   generics.ada:17:10: and therefore cannot appear in handler (RM 11.2(8))

and the AARM reason is "This is because the compiler doesn't know the
identity of such an exception, and thus can't enforce the coverage
rules." Well, if you say so ...


[-- Attachment #2: example --]
[-- Type: text/plain, Size: 334 bytes --]

generic
package G0 is
   Ex0 : exception;
   procedure P0;
end G0;
package body G0 is
   procedure P0 is null;
end G0;
with G0;
generic
   with package G is new G0 (<>);
procedure G1;
procedure G1 is
begin
   G.P0;
exception
   when G.Ex0 => null;
end G1;
with G0;
package R0 is new G0;
with G1;
with R0;
procedure R1 is new G1 (R0);

  reply	other threads:[~2018-01-22  9:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-21 15:43 making a son benefit access ton an instanciation of a generic package required as a formal parameter to his father and instanciated by him Mehdi Saada
2018-01-21 15:58 ` Simon Wright
2018-01-21 17:30   ` Mehdi Saada
2018-01-21 17:39     ` Simon Wright
2018-01-21 17:50     ` Dmitry A. Kazakov
2018-01-21 20:15       ` Mehdi Saada
2018-01-21 20:41         ` Dmitry A. Kazakov
2018-01-21 21:29           ` Mehdi Saada
2018-01-21 21:31             ` Mehdi Saada
2018-01-21 22:20               ` Jeffrey R. Carter
2018-01-21 23:07                 ` Mehdi Saada
2018-01-21 23:10                   ` Mehdi Saada
2018-01-22  8:28                   ` Dmitry A. Kazakov
2018-01-22  9:25                     ` Simon Wright [this message]
2018-01-23  1:23           ` Randy Brukardt
2018-01-21 22:04         ` J-P. Rosen
2018-01-22 15:36           ` Mehdi Saada
2018-01-22 15:54             ` Mehdi Saada
2018-01-22 15:52           ` Simon Wright
2018-01-23  1:33             ` Randy Brukardt
2018-01-23 14:05   ` Mehdi Saada
2018-01-23  1:13 ` Randy Brukardt
replies disabled

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