-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAA-10-1-6.html
More file actions
189 lines (185 loc) · 13.9 KB
/
Copy pathAA-10-1-6.html
File metadata and controls
189 lines (185 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Environment-Level Visibility Rules</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
H4.centered {text-align: center}
SPAN.swiss {font-family: Arial, Helvetica, sans-serif; font-size: 92%}
SPAN.roman {font-family: "Times New Roman", Times, serif}
DIV.paranum {float: left; font-family: Arial, Helvetica, sans-serif; font-size: 64%; width: 2.8em; margin-left: -0.4em; margin-right: -3.0em; margin-top: 0.2em}
TT {font-family: "Courier New", monospace}
DT {display: compact}
A.Bar:link {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}
A.Bar:visited {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}
DIV.Normal {font-family: "Times New Roman", Times, serif; line-height: 122%; margin-left: 1.8em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; font-size: 80%; line-height: 122%; margin-left: 6.8em; margin-bottom: 0.6em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#000080" VLINK="#330033" ALINK="#0000FF">
<DIV><SPAN Style="font-size:200%; color: rgb(0,51,153)"><B>Annotated</B></SPAN><SPAN Style="font-size:200%; color: rgb(0,0,102)"><B> Ada Reference Manual</B> (Ada 202y Draft 1)</SPAN> — <A HREF="AA-TTL.html"><B>Legal Information</B></A></DIV>
<div style="margin-top: 0.6em; margin-bottom: 0.0em"><A HREF="AA-TOC.html"><IMG SRC="cont.gif" ALT="Contents" BORDER=0></A>
<A HREF="AA-0-4.html"><IMG SRC="index.gif" ALT="Index" BORDER=0></A>
<A HREF="AA-STDS.html"><IMG SRC="lib.gif" ALT="References" BORDER=0></A>
<A HREF="AA-SRCH.html"><IMG SRC="find.gif" ALT="Search" BORDER=0></A>
<A HREF="AA-10-1-5.html"><IMG SRC="prev.gif" ALT="Previous" BORDER=0></A>
<A HREF="AA-10-2.html"><IMG SRC="next.gif" ALT="Next" BORDER=0></A>
</div>
<HR>
<H1>10.1.6 Environment-Level Visibility Rules</H1>
<div class="paranum"><a name="p1">1</a></div>
<div class="Normal">[The normal visibility rules do not apply within
a <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>
or a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>,
nor within a <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>
that appears at the place of a compilation unit. The special visibility
rules for those contexts are given here.] </div>
<H4 Class="centered">Static Semantics</H4>
<div class="paranum"><a name="p2">2/2</a></div>
<div class="Normal">{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-50217.TXT">AI95-00217-06</A></I>}
{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00312.TXT">AI95-00312-01</A></I>}
<A NAME="I5426"></A><A NAME="I5427"></A><A NAME="I5428"></A><A NAME="I5429"></A>Within
the <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>
at the beginning of an explicit <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>,
and within a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0296">nonlimited_with_clause</A></SPAN>,
the only declarations that are visible are those that are explicit <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>s
of the environment, and the only declarations that are directly visible
are those that are explicit root <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>s
of the environment. Within a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0295">limited_with_clause</A></SPAN>,
the only declarations that are visible are those that are the implicit
declaration of the limited view of a library package of the environment,
and the only declarations that are directly visible are those that are
the implicit declaration of the limited view of a root library package.</div>
<div class="paranum"><a name="p2.a">2.a</a></div>
<div class="Annotations"><B>Ramification: </B>In “<B>package</B>
P.Q.R <B>is</B> ... <B>end</B> P.Q.R;”, this rule requires P to
be a root library unit, and Q to be a library unit (because those are
the things that are directly visible and visible). Note that visibility
does not apply between the “<B>end</B>” and the “;”.</div>
<div class="paranum"><a name="p2.b">2.b</a></div>
<div class="Annotations">Physically nested declarations are not visible
at these places.</div>
<div class="paranum"><a name="p2.c">2.c</a></div>
<div class="Annotations">Although Standard is visible at these places,
it is impossible to name it, since it is not directly visible, and it
has no parent.</div>
<div class="paranum"><a name="p2.c.1">2.c.1/2</a></div>
<div class="Annotations">{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-50217.TXT">AI95-00217-06</A></I>}
Only compilation units defining limited views can be mentioned in a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0295">limited_with_clause</A></SPAN>,
while only compilation units defining full views (that is, the explicit
declarations) can be mentioned in a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0296">nonlimited_with_clause</A></SPAN>.
This resolves the conflict inherent in having two compilation units with
the same defining name. </div>
<div class="paranum"><a name="p2.d">2.d/2</a></div>
<div class="Annotations"><SPAN STYLE="font-size: 80%"><I>This paragraph
was deleted.</I></SPAN>{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00312.TXT">AI95-00312-01</A></I>}
</div>
<div class="paranum"><a name="p3">3</a></div>
<div class="Normal"><A NAME="I5430"></A><A NAME="I5431"></A><A NAME="I5432"></A><A NAME="I5433"></A>Within
a <SPAN Class="swiss"><A HREF="AA-8-4.html#S0235">use_clause</A></SPAN>
or <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>
that is within a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>,
each <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>
mentioned in a previous <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0294">with_clause</A></SPAN>
of the same <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>
is visible, and each root <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>
so mentioned is directly visible. In addition, within such a <SPAN Class="swiss"><A HREF="AA-8-4.html#S0235">use_clause</A></SPAN>,
if a given declaration is visible or directly visible, each declaration
that occurs immediately within the given declaration's visible part is
also visible. No other declarations are visible or directly visible.
</div>
<div class="paranum"><a name="p3.a">3.a</a></div>
<div class="Annotations"><B>Discussion: </B>Note the word “same”.
For example, if a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0294">with_clause</A></SPAN>
on a declaration mentions X, this does not make X visible in <SPAN Class="swiss"><A HREF="AA-8-4.html#S0235">use_clause</A></SPAN>s
and <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>s
that are on the body. The reason for this rule is the one-pass <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>s
Language Design Principle.</div>
<div class="paranum"><a name="p3.b">3.b</a></div>
<div class="Annotations">Note that the second part of the rule does not
mention <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>s.
</div>
<div class="paranum"><a name="p4">4</a></div>
<div class="Normal"><A NAME="I5434"></A><A NAME="I5435"></A>Within the
<SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>
of a subunit, <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>s
are visible as they are in the <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>
of a <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>;
in addition, the declaration corresponding to each <SPAN Class="swiss"><A HREF="AA-10-1-3.html#S0297">body_stub</A></SPAN>
in the environment is also visible. </div>
<div class="paranum"><a name="p4.a">4.a</a></div>
<div class="Annotations"><B>Ramification: </B>For a subprogram without
a separate <SPAN Class="swiss"><A HREF="AA-6-1.html#S0195">subprogram_declaration</A></SPAN>,
the <SPAN Class="swiss"><A HREF="AA-10-1-3.html#S0297">body_stub</A></SPAN>
itself is the declaration. </div>
<div class="paranum"><a name="p5">5</a></div>
<div class="Normal"><A NAME="I5436"></A><A NAME="I5437"></A>Within a
<SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN> that
appears at the place of a compilation unit, the immediately preceding
<SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>
and each of its ancestors is visible. The ancestor root <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0287">library_item</A></SPAN>
is directly visible.</div>
<div class="paranum"><a name="p6">6/2</a></div>
<div class="Normal">{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00312.TXT">AI95-00312-01</A></I>}
<A NAME="I5438"></A>Notwithstanding the rules of <A HREF="AA-4-1-3.html">4.1.3</A>,
an expanded name in a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0294">with_clause</A></SPAN>,
a <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN> in
a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>,
or a <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>
that appears at the place of a compilation unit may consist of a <SPAN Class="swiss"><A HREF="AA-4-1.html#S0093">prefix</A></SPAN>
that denotes a generic package and a <SPAN Class="swiss"><A HREF="AA-4-1-3.html#S0099">selector_name</A></SPAN>
that denotes a child of that generic package. [(The child is necessarily
a generic unit; see <A HREF="AA-10-1-1.html">10.1.1</A>.)] </div>
<div class="paranum"><a name="p6.a">6.a/2</a></div>
<div class="Annotations"><B>Reason: </B>This rule allows <B>with</B>
A.B; and <B>pragma</B> Elaborate(A.B); where A is a generic library package
and B is one of its (generic) children. This is necessary because it
is not normally legal to use an expanded name to reach inside a generic
package. </div>
<H4 Class="centered">Wording Changes from Ada 83</H4>
<div class="paranum"><a name="p6.b">6.b</a></div>
<div class="Annotations">The special visibility rules that apply within
a <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>
or a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>,
and within a <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>
that appears at the place of a <SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0286">compilation_unit</A></SPAN>
are clarified.</div>
<div class="paranum"><a name="p6.c">6.c</a></div>
<div class="Annotations">Note that a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>
is not part of any declarative region.</div>
<div class="paranum"><a name="p6.d">6.d</a></div>
<div class="Annotations">We considered making the visibility rules within
<SPAN Class="swiss"><A HREF="AA-10-1-1.html#S0291">parent_unit_name</A></SPAN>s
and <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>s
follow from the context of compilation. However, this attempt failed
for various reasons. For example, it would require <SPAN Class="swiss"><A HREF="AA-8-4.html#S0235">use_clause</A></SPAN>s
in <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>s
to be within the declarative region of Standard, which sounds suspiciously
like a kludge. And we would still need a special rule to prevent seeing
things (in our own <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>)
that were with-ed by our parent, etc. </div>
<H4 Class="centered">Wording Changes from Ada 95</H4>
<div class="paranum"><a name="p6.e">6.e/2</a></div>
<div class="Annotations">{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-50217.TXT">AI95-00217-06</A></I>}
Added separate visibility rules for <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0295">limited_with_clause</A></SPAN>s;
the existing rules apply only to <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0296">nonlimited_with_clause</A></SPAN>s.</div>
<div class="paranum"><a name="p6.f">6.f/2</a></div>
<div class="Annotations">{<I><A HREF="http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00312.TXT">AI95-00312-01</A></I>}
Clarified that the name of a generic child unit may appear in a <SPAN Class="swiss"><A HREF="AA-2-8.html#S0019">pragma</A></SPAN>
in a <SPAN Class="swiss"><A HREF="AA-10-1-2.html#S0292">context_clause</A></SPAN>.
</div>
<HR>
<div style="margin-top: 0.0em; margin-bottom: 0.6em"><A HREF="AA-TOC.html"><IMG SRC="cont.gif" ALT="Contents" BORDER=0></A>
<A HREF="AA-0-4.html"><IMG SRC="index.gif" ALT="Index" BORDER=0></A>
<A HREF="AA-STDS.html"><IMG SRC="lib.gif" ALT="References" BORDER=0></A>
<A HREF="AA-SRCH.html"><IMG SRC="find.gif" ALT="Search" BORDER=0></A>
<A HREF="AA-10-1-5.html"><IMG SRC="prev.gif" ALT="Previous" BORDER=0></A>
<A HREF="AA-10-2.html"><IMG SRC="next.gif" ALT="Next" BORDER=0></A>
</div>
<DIV Style="margin-top:0.0em"><IMG SRC="AE_logo.gif" height=100 width=113 align=right ALT="Ada-Europe">
<SPAN Style="vertical-align: middle; font-size:120%">Ada 2005 and 2012 Editions sponsored in part by <SPAN Style="font-size: 125%"><A HREF="http://www.ada-europe.org/"><B>Ada-Europe</B></A></SPAN></SPAN></DIV>
</BODY>
</HTML>