comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Recursive parameters in generics
Date: Tue, 24 Jul 2007 10:09:40 +0200
Date: 2007-07-24T10:05:55+02:00	[thread overview]
Message-ID: <rb5r7qu72sgd$.19mpqecqgqzo8.dlg@40tude.net> (raw)
In-Reply-To: 1185227470.756365.84630@z24g2000prh.googlegroups.com

On Mon, 23 Jul 2007 14:51:10 -0700, Adam Beneschan wrote:

> On Jul 23, 11:20 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> Hi there,
>>
>> out of curiosity, recently experimenting with workarounds for generics, I
>> invented a construct, which puzzles me. Is the following legal:
>>
>> generic
>>    S : String;
>> package A is
>>    S_Of : String renames S;
>> end A;
>> -----------------------------------
>> with A;
>> generic
>>    S : String;
>>    with package This_A is new A (S => S);
>> package B is
>> end B;
>> -----------------------------------
>> with A;
>> package My_A is new A (S => "whatever");
>> -----------------------------------
>> with My_A;
>> with B;
>> package My_B is
>>    new B (This_A => My_A, S => My_A.S_Of);
>> -----------------------------------
>> One could think that My_B would take S_Of from an instance of A and then
>> pass it back to A.
> 
> I don't see why this would be any different from
> 
> package My_B is new B (S => "whatever", This_A => My_A);

So you think it is legal?

> If you're thinking about My_B passing something back to A, you're
> probably thinking about the whole problem sideways.  My_B doesn't
> instantiate A at all, it uses an already-existing instance of A.

I mean the process of matching parameters. I.e. what happens at the
instantiation point. At least it perplexes GNAT, provided the thingy is
legal.

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



  reply	other threads:[~2007-07-24  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23 18:20 Recursive parameters in generics Dmitry A. Kazakov
2007-07-23 19:32 ` Maciej Sobczak
2007-07-23 19:46   ` Dmitry A. Kazakov
2007-07-23 21:51 ` Adam Beneschan
2007-07-24  8:09   ` Dmitry A. Kazakov [this message]
2007-07-24 16:00     ` Adam Beneschan
2007-07-25  6:43       ` AW: " Grein, Christoph (Fa. ESG)
2007-07-25 15:13         ` Adam Beneschan
replies disabled

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