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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed-0.progon.net!progon.net!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Recursive parameters in generics Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1k85hjmq18rzl$.k999u7frmtye.dlg@40tude.net> <1185227470.756365.84630@z24g2000prh.googlegroups.com> Date: Tue, 24 Jul 2007 10:09:40 +0200 Message-ID: NNTP-Posting-Date: 24 Jul 2007 10:05:55 CEST NNTP-Posting-Host: c9e16cf2.newsspool4.arcor-online.net X-Trace: DXC=MB>23AHQI;a_0Po7BmQ3]l4IUKoLk1:]i]I:7h X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16582 Date: 2007-07-24T10:05:55+02:00 List-Id: On Mon, 23 Jul 2007 14:51:10 -0700, Adam Beneschan wrote: > 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); 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