comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: A proposal for formal packages matching
Date: Mon, 15 Dec 2008 20:09:25 -0600
Date: 2008-12-15T20:09:25-06:00	[thread overview]
Message-ID: <gi72ks$jgk$1@munin.nbi.dk> (raw)
In-Reply-To: efef2f63-4591-4048-957d-d01c6bb53b12@s1g2000prg.googlegroups.com

> On Dec 15, 11:21 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> 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.





  parent reply	other threads:[~2008-12-16  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 10:21 A proposal for formal packages matching Dmitry A. Kazakov
2008-12-15 12:13 ` Ludovic Brenta
2008-12-15 13:29   ` Dmitry A. Kazakov
2008-12-15 15:43     ` Ludovic Brenta
2008-12-15 19:21       ` Dmitry A. Kazakov
2008-12-16  2:09   ` Randy Brukardt [this message]
2008-12-16  8:34     ` Dmitry A. Kazakov
replies disabled

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