comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Visibility of package parameters in child packages
Date: Wed, 16 Dec 2009 13:44:22 -0800 (PST)
Date: 2009-12-16T13:44:22-08:00	[thread overview]
Message-ID: <3efa2955-34eb-42e3-b3c5-137fa80c01cd@v15g2000prn.googlegroups.com> (raw)
In-Reply-To: 4b292ce7$0$6730$9b4e6d93@newsspool2.arcor-online.net

On Dec 16, 10:54 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:

> My idea, possibly confused, is that somehow the
> formal parameter F of generic package Q is not made visible
> in Parent.Child.
>
> With LRM 95 12.7(10) in mind,
>
> generic
>    with package P is new Q (<>);
>    ...
> package Parent...
>
> means, I think, that the parameters for which (<>) stands
> are included in visibility decisions.
>
> >http://www.adapower.com/adapower1/rm95/arm95_187.html
>
> (The paragraph numbering on that page is a bit different from
> what is normally used in the RM. (10) means the tenth paragraph
> which happens to be "Static Semantics, 2nd", on adapower.com)

Be careful here.  (10) is not necessarily the tenth paragraph, because
additions to the languages have caused paragraphs to be inserted,
which are then given numbers like (4.1), (5.1), etc.  In the Ada 2005
manual, 12.7(10) is actually the 18th paragraph of section 12.7.  The
RM available at www.adaic.org/standards has the official paragraph
numbers.

> "The visible part of a formal package includes the first
> list of basic_declarative_items of the package_specification.
> In addition, if the formal_package_actual_part is (<>),
> it also includes the generic_formal_part of the template
> for the formal package.">
> P is the formal package with formal_package_actual_part (<>).
> Q is the template, F is in Qs generic_format_part.
> So F should be as visible as anything specified in P.
> But I'm a layman, hopefully some expert can explain all this

You're right that F should be as visible as anything else visible in
P.  The official rule in Ada 2005 is "for each actual parameter that
is not required to match, a copy of the declaration of the
corresponding formal parameter of the template is included in the
visible part of the formal package."  Thus, in the declaration

  with package P is new Q(<>);

the formal package P will have copies of T and F in the visible part
of P, in addition to the other stuff copied from the visible part of
Q.  Thus, "use P" should make T and F directly visible just as other
declarations in the visible part of P would be directly visible.

In answer to your previous question: Ada 2005 did change this, but it
extended this by allowing generic formal packages in which some formal
parameters were required to match but others were not.  This change
didn't affect the semantics of formal packages that were legal in Ada
95.

                              -- Adam




  reply	other threads:[~2009-12-16 21:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 19:28 Visibility of package parameters in child packages Andrea Taverna
2009-12-15 21:00 ` Georg Bauhaus
2009-12-16 11:50   ` Andrea Taverna
2009-12-16 13:14     ` Georg Bauhaus
2009-12-16 14:21       ` Andrea Taverna
2009-12-16 15:54         ` Georg Bauhaus
2009-12-16 16:54           ` Andrea Taverna
2009-12-16 18:54             ` Georg Bauhaus
2009-12-16 21:44               ` Adam Beneschan [this message]
2009-12-16 21:26             ` sjw
2009-12-17  0:19     ` Randy Brukardt
2009-12-17 18:50       ` Ludovic Brenta
2009-12-16 21:27 ` Adam Beneschan
replies disabled

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