comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@s.netic.de>
Subject: Re: Problem with instantiating generic procedure
Date: 1999/07/18
Date: 1999-07-18T11:42:50+00:00	[thread overview]
Message-ID: <m3so6mdw05.fsf@deneb.cygnus.stuttgart.netsurf.de> (raw)
In-Reply-To: 7ms4en$kl8$1@pegasus.csx.cam.ac.uk

mgk25@cl.cam.ac.uk (Markus Kuhn) writes:

> Florian Weimer <fw@s.netic.de>:
> |> 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).




  reply	other threads:[~1999-07-18  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-17  0:00 Problem with instantiating generic procedure Markus Kuhn
1999-07-17  0:00 ` Florian Weimer
1999-07-18  0:00   ` Markus Kuhn
1999-07-18  0:00     ` Florian Weimer [this message]
1999-07-19  0:00       ` Robert Dewar
1999-07-19  0:00         ` Florian Weimer
1999-07-18  0:00     ` Chad R. Meiners
1999-07-17  0:00 ` Vladimir Olensky
1999-07-18  0:00 ` David C. Hoos, Sr.
1999-07-19  0:00 ` Robert A Duff
1999-07-19  0:00 ` Tucker Taft
1999-07-19  0:00   ` Markus Kuhn
1999-07-23  0:00     ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox