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,T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,33afa3244ab891f7,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!newsfeed00.sul.t-online.de!t-online.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Specialization generic package parameters 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 Date: Fri, 23 May 2008 19:29:49 +0200 Message-ID: <1996bbhvwjxcr$.1s16brw83713g$.dlg@40tude.net> NNTP-Posting-Date: 23 May 2008 19:29:50 CEST NNTP-Posting-Host: 453a859a.newsspool4.arcor-online.net X-Trace: DXC=;boHMo8_\j_=>bdbdS?M0Y4IUK Recently I ran into the following problem with generic packages. Consider type T is tagged null record; and a generic package that uses it: generic type Some_T is new T with private; package P is ... private ... end P; Let there be some type S derived from T: type S is new T with null record; Now the question is, how to derive another package Q from P, specialized for S, while keeping access to the private part of P? Neither of patterns I know works. 1. Nested package: generic type Some_S is new S with private; package Q is package P_S is new P (Some_S); -- This specializes P private -- No access to the private part of P! end Q; 2. Formal package: generic type Some_S is new S with private; package P_S is new P (Some_S); -- This specializes P package Q is ... private -- No access to the private part of P! end Q; 3. Child package generic package P.Q is private -- Got access to the private part, but -- lost specialization, as the parameter -- of P is no more constrained to S. end P; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de