comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Visibility problems with package instantiations.....
Date: Thu, 27 Nov 2003 17:33:50 +0100
Date: 2003-11-27T17:33:50+01:00	[thread overview]
Message-ID: <349csv0udb5k0kuk0q99d7tm7fh5leuefu@4ax.com> (raw)
In-Reply-To: 95234e08.0311270742.631b1228@posting.google.com

On 27 Nov 2003 07:42:40 -0800, petter.fryklund@atero.se (Petter
Fryklund) wrote:

>We have the following:
>
>generic 
>   type A is mod (<>);
>   type B is mod (<>);
>package Gen_0 is
>   type C is 
>      record
>         AA : A;
>         BB : B;
>      end record;
>end Gen_0;
>
>with Gen_0;
>generic
>   with package Inst_0 is new Gen_0 (<>);
>package Gen_1 is
>   procedure X (P1 : Inst_0.C);
>end Gen_1;
>
>with Gen_0;

+ with Gen_1; -- I suppose

>generic
>   with package Inst_0 is new Gen_0 (<>);
>   with package Inst_1 is new Gen_1 (<>);
>package Gen_2 is
>   procedure X (P1 : Inst_0.C);
>end Gen_2;
>
>package body Gen_2 is
>   procedure X (P1 : Inst_0.C) is
>   begin
>      Inst_1 (P1); <---- visibility problems.

Inst_1.X (P1); -- Probably

Provided that my assuptions are correct then Inst_1.X cannot be called
with Inst_0.C, because Inst_1.Inst_0.C and Inst_0.C are different
types, at least for the compiler. So either

1. they are not and should not be, then:

generic
   with package Inst_0 is new Gen_0 (<>);
   with package Inst_1 is new Gen_1 (<>);
package Gen_2 is
   procedure X (P1 : Inst_1.Inst_0.C);
      -- The right type is  Inst_1.Inst_0.C
end Gen_2;

2. they should be same, then

generic
   with package Inst_0 is new Gen_0 (<>);
   with package Inst_1 is new Gen_1 (Inst_0);
      -- Inst_1 shall be instantiated with Inst_0
package Gen_2 is
   procedure X (P1 : Inst_0.C);
end Gen_2;

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



  reply	other threads:[~2003-11-27 16:33 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 [this message]
2003-11-28 11:23   ` Petter Fryklund
2003-11-28 13:17     ` Dmitry A. Kazakov
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