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,c0d427d5f4af20f8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Tue, 13 Sep 2005 14:36:57 -0500 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: generics in Ada 83 References: <1126617980.932226.320710@g43g2000cwa.googlegroups.com> <4326d73a$1_1@glkas0286.greenlnk.net> <1126629046.328151.40970@g47g2000cwa.googlegroups.com> <1126636985.067939.27760@f14g2000cwb.googlegroups.com> Date: Tue, 13 Sep 2005 21:37:17 +0200 Message-ID: <87r7bshi8i.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:/WIVZsB8sABVe5s9mbKeOc4U5lE= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 83.134.243.143 X-Trace: sv3-eaBa6i/xqv2uFpsVgOvcps3kpZB0GZQrWkD1CIo/eWAPuk2JFS875ByOXEu8ysFiJz965j1PgZ+3I1/!GZ/d5IniHLnygjYyd1A4WJkiDhTCCQJaFJAAeevxFp47o1p+ZVa77Rad4TqqtGVdbNO0be3JJxU= X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:4627 Date: 2005-09-13T21:37:17+02:00 List-Id: "REH" writes: > Martin Dowie wrote: >> package A is >> type A_T is private; >> procedure Y (Z : A_T); >> private >> type A_T is new Integer; >> end A; >> >> generic >> type X is private; >> with procedure Y (Z : X) is <>; >> package B is >> end B; >> >> with A; use A; >> with B; >> >> package C is >> new B (A_T); -- Picks up 'Y' by default >> >> Cheers >> >> -- Martin > > That seems reasonable. Two questions: > 1) If I have Y1 through Yn, Do I define the ones I care about when I > instantiate B or do I define then in C, before B? If there are several Y's to choose from, you must choose at the point of instantiation of B: with A, B; package C is new B (X => A.A_T, Y => A.Yn); > 2) is there a way to avoid having to include A? C must see the type and procedure passed to it as actual generic parameters, so there I can think of no way to avoid withing A. -- Ludovic Brenta.