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: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 16 Apr 2014 08:03:15 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problem with generic package References: <1ffb84f0-5e50-4807-90ff-dfdfac11c501@googlegroups.com> <1807366a-55d8-4d47-953c-d857f69a3306@googlegroups.com> <9f51076f-71cf-4735-a930-6021946491e8@googlegroups.com> <9c505412-8f30-4e1a-9374-a0d8d12f8db0@googlegroups.com> In-Reply-To: <9c505412-8f30-4e1a-9374-a0d8d12f8db0@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <534e1d23$0$6710$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 16 Apr 2014 08:03:15 CEST NNTP-Posting-Host: 6de2a0a5.newsspool3.arcor-online.net X-Trace: DXC=YR_QIZN9iY`m7>ihJR; B_cMcF=Q^Z^V3h4Fo<]lROoRa8kFejVhXdLGJfn3\JnjCOgP[VlJ8b X-Complaints-To: usenet-abuse@arcor.de X-Original-Bytes: 2740 Xref: number.nntp.dca.giganews.com comp.lang.ada:185762 Date: 2014-04-16T08:03:15+02:00 List-Id: On 15/04/14 23:58, Laurent wrote: > >> You can only instantiate Array_Generics. Search_Generic is not a generic. > Concerning (1) and (2): No I have some (1)'s and I try to put them into (2) to get rid of the (1)'s. Where I want (2) to be a package which contains a generic swap, sort and search function/procedure. Right. As Adam explains, you need to declare them so. generic the package's parameters package p is ... generic -- ? further, the procedure's parameters -- ? procedure a (...) is end p; If procedure `a' should operate in terms of the package's parameters, and no further, special, generic formal parameters of its own, then it need not be generic on its own, since each instance of the package also makes one procedure `a' that sees the actuals "around" it, i.e., the types etc. passed to the package's formal parameters on instantiation of package p. If, on the other hand, procedure `a' needs generic parameters in addition to those of the package in which it is declared, then it needs to be declared as a generic as shown, preceded by its own "generic" part. Example: generic type T is private; package Stack is procedure push (Item : T); generic with function Compare (X, Y : T) return Boolean; procedure Sort; end Stack;