From: Adam Beneschan <adam@irvine.com>
Subject: Re: Recursive parameters in generics
Date: Mon, 23 Jul 2007 14:51:10 -0700
Date: 2007-07-23T14:51:10-07:00 [thread overview]
Message-ID: <1185227470.756365.84630@z24g2000prh.googlegroups.com> (raw)
In-Reply-To: <1k85hjmq18rzl$.k999u7frmtye.dlg@40tude.net>
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);
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.
-- Adam
next prev parent reply other threads:[~2007-07-23 21:51 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 [this message]
2007-07-24 8:09 ` Dmitry A. Kazakov
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