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: "J-P. Rosen" 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: Sun, 21 Jan 2018 23:04:07 +0100 Organization: Adalog Message-ID: References: <193126c2-f171-43ed-8c7c-00570f1dd4d4@googlegroups.com> <1eb1f57d-36fa-4bf0-8a40-5b32d71e5c28@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 22 Jan 2018 09:10:37 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="151abd7ca332eb73740959ef2fc473c7"; logging-data="9941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VIPmx1bgG761NlO/cfvY8" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 In-Reply-To: Content-Language: fr Cancel-Lock: sha1:8ZHVrKZPH4G6w8WZ/GKMkp2Rzrc= Xref: reader02.eternal-september.org comp.lang.ada:50052 Date: 2018-01-21T23:04:07+01:00 List-Id: Le 21/01/2018 à 21:15, Mehdi Saada a écrit : > Thanks Dmitry. I just stumpled against another exemple of your point 1, RM's paragraph 11.2.8: > An exception_name of a choice shall not denote an exception declared in a generic formal package. Right, and there is a good reason. Assuming exception E is declared in generic package GP1: Imagine this: generic package P1 is new GP1 (<>); package P2 is new GP1 (<>); package GP2 is... end GP2; package body GP2 is ... begin exception when P1.E => -- not allowed by Ada ... when P2.E => -- not allowed by Ada ... end GP2; So far, so good. But then, if you instantiate: package Inst1 is new GP1; package Inst2 is new GP2 (Inst1, Inst1); then you would end up with two different handlers for the same exception (since formals P1 and P2 are actually the same package Inst1). And that's a no-no! I agree with Dmitry (It happens sometimes ;-) ) that normally, exceptions are better declared outside of generics. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr