From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada 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 Organization: A noiseless patient Spider Message-ID: References: <193126c2-f171-43ed-8c7c-00570f1dd4d4@googlegroups.com> <1eb1f57d-36fa-4bf0-8a40-5b32d71e5c28@googlegroups.com> <6378807a-d938-4fac-938b-d3a8616d7f25@googlegroups.com> <297e4450-9934-40b8-9b55-1b16b3e421e4@googlegroups.com> <531299d8-af8e-45b4-9531-61a3bff7b42c@googlegroups.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: reader02.eternal-september.org; posting-host="975865909b2e90636fe380644478e94e"; logging-data="15060"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XOgybs4fMeku7XXl91f4X9A+6uWC8xIg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:y7iJNWt+5Cee1n6zZw14/y79h6Y= sha1:56VjE0iNwJE7ayOuwWw5jzEaSq0= Xref: reader02.eternal-september.org comp.lang.ada:50053 Date: 2018-01-22T09:25:11+00:00 List-Id: --=-=-= Content-Type: text/plain "Dmitry A. Kazakov" 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 ... --=-=-= Content-Type: text/plain Content-Disposition: inline Content-Description: example 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); --=-=-=--