comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: A proposal for formal packages matching
Date: Mon, 15 Dec 2008 04:13:47 -0800 (PST)
Date: 2008-12-15T04:13:47-08:00	[thread overview]
Message-ID: <efef2f63-4591-4048-957d-d01c6bb53b12@s1g2000prg.googlegroups.com> (raw)
In-Reply-To: ugbgacg90vkd.1fijdixn7a5z4.dlg@40tude.net

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.

--
Ludovic Brenta.



  reply	other threads:[~2008-12-15 12:13 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 [this message]
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
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