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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9747037d09060687 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!u-picardie.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: A proposal for formal packages matching Date: Mon, 15 Dec 2008 20:09:25 -0600 Organization: Jacob Sparre Andersen Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1229393372 19988 69.95.181.76 (16 Dec 2008 02:09:32 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 16 Dec 2008 02:09:32 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:3972 Date: 2008-12-15T20:09:25-06:00 List-Id: > On Dec 15, 11:21 am, "Dmitry A. Kazakov" > wrote: >> There seems one overlooked thing in the rules controlling matching formal >> packages. An instance of generic child package does not match as an >> instance of the generic parent. >> >> I mean the following: >> >> generic >> package Generic_A is >> end Generic_A; >> >> package A is new Generic_A; >> >> generic >> package Generic_A.Generic_B is >> end Generic_A.Generic_B; >> >> package AB is new A.Generic_B; This is illegal; you need a with clause on A and on Generic_B: with A, Generic_A.Generic_B; package AB is new A.Generic_B; (I'm not certain I have this exactly right; Steve Baird calls the process where these generics become visible as "sprouting", because it is soo weird. I'd preferred to have done without generic children altogether, but it's too late for that.) >> >> generic >> with package A is new Generic_A (<>); >> package Generic_Foo is >> end Generic_Foo; >> >> package Foo is new Generic_Foo (AB); >> -- Error: AB is not an instance of Generic_A >> >> Semantically, AB being an extension of Generic_A can be considered an >> instance of. This doesn't make any sense to me. AB is not an instance of Generic_A. Period. It's a different unit. You need to reference A here (I'm sure you know that). Implicitly referencing a parent unit is very weird, especially as you want to do so for a unit that it isn't ever clear that it has a parent. Indeed, the declaration of "AB" is dubious. The intent of the language designers (as I best I understand it) was for these instances to also be children. with Generic_A.Generic_B; package A.B is new A.Generic_B; in which case there wouldn't be any temptation to reference the parent implicitly. Randy.