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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8ceb83dbf250e264 X-Google-Attributes: gid103376,public From: "Chad R. Meiners" Subject: Re: Problem with instantiating generic procedure Date: 1999/07/18 Message-ID: <932349592.866.100@news.remarQ.com>#1/1 X-Deja-AN: 502563652 References: <7mqfcq$9og$1@pegasus.csx.cam.ac.uk> <7ms4en$kl8$1@pegasus.csx.cam.ac.uk> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: newsabuse@remarQ.com X-Trace: 932349592.866.100 ZYYQ2O1IFB376CE97C qube-02.us-ca.remarq.com Organization: Posted via RemarQ, http://www.remarQ.com - The Internet's Discussion Network X-MSMail-Priority: Normal NNTP-Posting-Date: Mon, 19 Jul 1999 01:59:52 GMT Newsgroups: comp.lang.ada Date: 1999-07-18T00:00:00+00:00 List-Id: Perhaps the follow solution is an acceptable alterative to renaming generic instantiations: Package Generics is generic Type Parameter is private; procedure G(Item : Parameter); end Generics; Package body Generics is Procedure G(Item : Parameter) is begin null; end G; end Generics; with Generics; Package Instantiations is Procedure A is new Generics.G(Integer); --Procedure A(Item : Integer); end Instantiations; The only problem with this solution is that Generics is not a private package, but I don't think that would be a problem in your case. -Chad R. Meiners Markus Kuhn wrote in message news:7ms4en$kl8$1@pegasus.csx.cam.ac.uk... > Florian Weimer : > |> ARM 6.1(20): > |> > |> | A subprogram_declaration or a generic_subprogram_declaration requires > |> | a completion: a body, a renaming_declaration (see 8.5), or a pragma > |> | Import (see B.1). A completion is not allowed for an > |> | abstract_subprogram_declaration. > > Thanks! But the RM also says in section 12.3: > > A generic_instantiation declares an instance; it is equivalent to the > instance declaration (a package_declaration or subprogram_declaration) > immediately followed by the instance body, both at the place of the > instantiation. > > So if 6.1 says that a subprogram_declaration requires a body and 12.3 says that > a generic instantiation does provide the equivalent of a body, then I still > do not understand where the RM says that my program is illegal. In addition, > I see absolutely no good reason, why the language should forbid this. It just > requires an ugly workaround via renaming, which forces me to pollute the object > namespace and makes the code less readable by introducing yet another temporary > name for something. In my case, I make over 30 instantiations (I am writing a type-safe > binding for the linux ioctl() system calls), so I also have to add now over 30 > renames, which looks really ugly. > > I guess I'll submit it as a bug report to ACT and let them decide whether it is > just an unclear error message or a non-conformity to the RM. In any case, if someone > keeps an Ada 0X wish list, please put adding generic instantiations to 6.1(20) onto > it. > > |> I guess this means that an instance of a generic subprogram isn't allowed > |> as a completion for a subprogram declaration. The obvious workaround > |> is using a renaming declaration. Of course, the GNAT error message > |> could be a bit more helpful. > > Markus > > -- > Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK > Email: mkuhn at acm.org, WWW: