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: Florian Weimer Subject: Re: Problem with instantiating generic procedure Date: 1999/07/18 Message-ID: #1/1 X-Deja-AN: 502371036 References: <7mqfcq$9og$1@pegasus.csx.cam.ac.uk> <7ms4en$kl8$1@pegasus.csx.cam.ac.uk> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@cygnus.stuttgart.netsurf.de X-Trace: deneb.cygnus.stuttgart.netsurf.de 932298170 868 192.168.0.1 (18 Jul 1999 11:42:50 GMT) Organization: Penguin on board Mime-Version: 1.0 User-Agent: Gnus/5.070095 (Pterodactyl Gnus v0.95) XEmacs/21.1 (20 Minutes to Nikko) NNTP-Posting-Date: 18 Jul 1999 11:42:50 GMT Newsgroups: comp.lang.ada Date: 1999-07-18T11:42:50+00:00 List-Id: mgk25@cl.cam.ac.uk (Markus Kuhn) writes: > 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. You have two subprogram declarations, one in the package specification and one implicitly created by the instantiation in the package body. I suppose this isn't allowed (ARM 6.1(1)): | [...] The definition of a subprogram can be given in two parts: a | subprogram declaration defining its interface, and a subprogram_body | defining its execution. [...] > In addition, I see absolutely no good reason, why the language > should forbid this. >From my limited point of view, I don't see it either. There's a related thing I'd like to see improved in a future Ada revision: pragma Import requires the use of renaming declarations as well if the Ada functions in question are overloaded. The effects are quite similar here (namespace pollution).