comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: A proposal for formal packages matching
Date: Mon, 15 Dec 2008 14:29:57 +0100
Date: 2008-12-15T14:29:57+01:00	[thread overview]
Message-ID: <1b1brfydbng85$.106aaoguop29f.dlg@40tude.net> (raw)
In-Reply-To: efef2f63-4591-4048-957d-d01c6bb53b12@s1g2000prg.googlegroups.com

On Mon, 15 Dec 2008 04:13:47 -0800 (PST), Ludovic Brenta wrote:

> 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;
>>
>> 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.
> 
> No, because semantically, packages are not types. They are units of
> visibility. And they are orthogonal to type extension, dynamic
> dispatching and object-oriented programming if that's what you have in
> mind.

I didn't. (For that matter the concept of type extension is questionable.)

I meant exclusively visibility. A child package has parent's declaration
visible in its body.

   package Foo is new Generic_Foo (AB);

should read, "take AB or any of its parents, which is an instance of
Generic_A."

[ Presently it is insolvable in an implicit form, because the actual of the
parent package has no name. Differently to the formal parameters, which
actuals are anonymous "outside," but named "inside," parents are anonymous
for all sights. ]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-12-15 13:29 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 [this message]
2008-12-15 15:43     ` Ludovic Brenta
2008-12-15 19:21       ` Dmitry A. Kazakov
2008-12-16  2:09   ` Randy Brukardt
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