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,70414f56d810c10c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.52.10 with SMTP id p10mr1722443pbo.17.1316445336064; Mon, 19 Sep 2011 08:15:36 -0700 (PDT) Path: lh7ni515pbb.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Mon, 19 Sep 2011 17:14:45 +0200 Organization: cbb software GmbH Message-ID: <1kx7ltnsal62q.195k449mr947t.dlg@40tude.net> References: <9f37b726-d80b-4d24-bf3f-28a14255f7fd@s20g2000yql.googlegroups.com> <708a1202-d480-451b-9b55-00b31ad9c452@w28g2000yqw.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:18031 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-19T17:14:45+02:00 List-Id: On Mon, 19 Sep 2011 07:46:15 -0700 (PDT), ytomino wrote: > Please look below: > > procedure q1 is > generic > type e is private; > package the_package_like_ada2012_vector is > type ref (element : not null access e) is null record; > end the_package_like_ada2012_vector; > generic > type e is private; > type ref (element : not null access e) is private; The relevant part is probably 12.5.1(14): "The subtype of each discriminant of the actual type shall statically match the subtype of the corresponding discriminant of the formal type." which I read as *no formal generic discriminants*. I.e. if "statically match" means what I think, then "element" in type ref (element : not null access e) is private; cannot be matched because "e" is a formal generic parameter. As a work-around, make the second package a child or pass the first one as a parameter to it. BTW, as my experience shows, designs based on generics fail, and ones passing formal parameters of one generics to other generics fail always. Nobody would ever able to instantiate this mess or say what was wrong. Generic children/formal packages alleviate the problem. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de