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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Problem with generic package Date: Tue, 15 Apr 2014 21:41:42 +0100 Organization: A noiseless patient Spider Message-ID: References: <1ffb84f0-5e50-4807-90ff-dfdfac11c501@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="a0d4eb314a073b71869f2de305ad0700"; logging-data="18958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rDXxUPItHSI2nAvRzJYyvzqVm7Mgr9FU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:itdpyBmCd/z+YHfHbm0NvZFgif8= sha1:frU84EkOgNHpcSQ0ArkI2mcn6nM= Xref: news.eternal-september.org comp.lang.ada:19316 Date: 2014-04-15T21:41:42+01:00 List-Id: Laurent writes: > procedure Sort_Generic (List : in out List_Type) is > > -- We need to make an instance of Swap_Generic for this case > > error ==>procedure Exchange is new Swap_Generic (Value_Type => Element_Type); <== error You do *not* need to make an instance of Swap_Generic; within the body of Array_Generic you can refer to Swap_Generic as it is. And, as Adam says, Swap_Generic isn't actually a generic subprogram in its own right, it's "just" a subprogram in a generic package. The compiler messages I got were array_generics.adb:18:33: expect generic subprogram in instantiation array_generics.adb:36:13: "Exchange" is undefined so delete the first line and replace Exchange by Swap_Generic in the second. By the way, GNAT works much better if you stick with lower-case file names (I think your code wouldn't compile on Linux, which has case-sensitive file names; when compiling Array_Generics.adb GNAT expects to find array_generics.ads, not Array_Generics.ads).