From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d1c2be706bbed0a5 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z24g2000prh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Recursive parameters in generics Date: Mon, 23 Jul 2007 14:51:10 -0700 Organization: http://groups.google.com Message-ID: <1185227470.756365.84630@z24g2000prh.googlegroups.com> References: <1k85hjmq18rzl$.k999u7frmtye.dlg@40tude.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185227471 21041 127.0.0.1 (23 Jul 2007 21:51:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Jul 2007 21:51:11 +0000 (UTC) In-Reply-To: <1k85hjmq18rzl$.k999u7frmtye.dlg@40tude.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: z24g2000prh.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:16575 Date: 2007-07-23T14:51:10-07:00 List-Id: On Jul 23, 11:20 am, "Dmitry A. Kazakov" 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