comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Visibility problems with package instantiations.....
Date: Fri, 28 Nov 2003 14:17:03 +0100
Date: 2003-11-28T14:17:03+01:00	[thread overview]
Message-ID: <n8hesvkm0cad6p3sbvkrahbuiv9ap61gr0@4ax.com> (raw)
In-Reply-To: 95234e08.0311280323.7a5bb870@posting.google.com

On 28 Nov 2003 03:23:50 -0800, petter.fryklund@atero.se (Petter
Fryklund) wrote:

>Now taking this further. If Gen_3 only needs a few of the parameters
>of the instantiation of Inst_2 to be correct or known, wouldn't it be
>nice to be able to do:
>
>with Gen_0;
>with Gen_1; -- with 200 other parameters ....
>generic
>   with package Inst_0 is new Gen_0 (<>);
>   with package Inst_1 is new Gen_1 (Inst_0 => Inst_0, others =>
>(<>));
>package Gen_2 is
>   .....

Well I am not a fan of generics. Any implementation based on generics
is suspicious to my taste. That's aside.

Returning to your question, a package with 200 parameters is even more
suspicious from design point of view, than the fact of being generic.

However, there is another way to "inherit" from packages. Ada offers
child packages. For example you could make Gen_1 a child of Gen_0 to
inherit all its generic parameters.

To your proposal. It goes the direction of making generic formal
parameter profiles to closer resemble the parameter profiles of
subprograms. That's not easy. If we dig it a bit deeper, we will
discover that for example:

   procedure Foo (X : Integer; X : Float);  -- Clearly illegal

but

   generic
      with function X return Integer;
      with function X return Float;
   procedure Foo;  -- This is fine!

So any proposal concerning named associations of the generic
parameters should somehow deal with this nasty problem (at least).

BTW, true procedural types could help here, because then, one could
use qualified expressions. Alas, Ada misses them.

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



  reply	other threads:[~2003-11-28 13:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-27 15:42 Visibility problems with package instantiations Petter Fryklund
2003-11-27 16:33 ` Dmitry A. Kazakov
2003-11-28 11:23   ` Petter Fryklund
2003-11-28 13:17     ` Dmitry A. Kazakov [this message]
2003-12-01  7:45       ` Petter Fryklund
2003-12-01  8:58         ` Dmitry A. Kazakov
2003-12-01 16:31           ` Stephen Leake
2003-12-02  9:00             ` Dmitry A. Kazakov
2003-12-02 16:20               ` Stephen Leake
2003-12-03  8:37                 ` Dmitry A. Kazakov
2003-12-03 18:09                   ` Stephen Leake
2003-12-04  9:16                     ` Dmitry A. Kazakov
2003-12-04 13:09                       ` Stephen Leake
2003-12-04 14:03                         ` Dmitry A. Kazakov
2003-12-04 19:24                         ` Randy Brukardt
2003-12-05  0:30                           ` Stephen Leake
2003-12-05  2:58                             ` Randy Brukardt
2003-12-05 14:04                               ` Stephen Leake
2003-12-05 12:14                           ` Jeff C,
2003-12-05 13:13                             ` Arnaud Charlet
2003-12-05 20:52                               ` Randy Brukardt
2003-12-05 21:10                                 ` Simon Wright
2003-12-02 17:07               ` Jeffrey Carter
2003-12-03  8:49                 ` Dmitry A. Kazakov
2003-12-02  4:25         ` Randy Brukardt
replies disabled

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