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,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: mgk25@cl.cam.ac.uk (Markus Kuhn) Subject: Re: Problem with instantiating generic procedure Date: 1999/07/18 Message-ID: <7ms4en$kl8$1@pegasus.csx.cam.ac.uk>#1/1 X-Deja-AN: 502327805 References: <7mqfcq$9og$1@pegasus.csx.cam.ac.uk> Organization: U of Cambridge Computer Lab, UK Newsgroups: comp.lang.ada Date: 1999-07-18T00:00:00+00:00 List-Id: 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: