CVS difference for ais/ai-50217.txt
--- ais/ai-50217.txt 2003/09/19 01:42:29 1.7
+++ ais/ai-50217.txt 2003/09/23 03:47:49 1.8
@@ -1,4 +1,4 @@
-!standard 10.01.02 (03) 03-09-09 AI95-00217-06/03
+!standard 10.01.02 (03) 03-09-22 AI95-00217-06/04
!standard 10.01.02 (04)
!standard 10.01.02 (08)
!standard J.10 (00)
@@ -29,21 +29,21 @@
!proposal
A new kind of with_clause is added, of the form "limited with <library
-package names>;". This is called a "limited_with_clause". The old
+package names>;". This is called a "limited_with_clause". The old
fashioned kind is called a "nonlimited_with_clause".
There are two key features of a limited_with_clause such as "limited
with X;":
- It introduces no semantic dependence on X (and hence no
- elaboration dependence on X). The implementation may choose to
+ elaboration dependence on X). The implementation may choose to
elaborate X either before or after the current unit.
- Instead of providing visibility to the named packages and their
content, it provides visibility only to the package names, any
packages nested within them, and a view of each type therein.
The type view is incomplete, implying all the usual restrictions
- on incomplete types. If the type is tagged, the view is tagged
+ on incomplete types. If the type is tagged, the view is tagged
incomplete.
Thus, cyclic chains of with_clauses are allowed, so long as the chain is
@@ -54,7 +54,7 @@
Replace 3.10.1(10) by:
A dereference (whether implicit or explicit -- see 4.1) is only allowed to be
-of an incomplete type T if it does not occur in the declarative region of [the
+of an incomplete type T if it does not occur in the immediate scope of [the
incomplete type] T and:
o it occurs in the scope of a nonlimited_with_clause that mentions the library
@@ -66,7 +66,7 @@
Replace 4.1(9) by:
If the type of the name in a dereference is some access-to-object type T, then
-the dereference denotes a view of an object. The nominal subtype of that view
+the dereference denotes a view of an object. The nominal subtype of that view
is the designated subtype T, unless T is an incomplete type, in which case the
nominal subtype is the completion of T.
@@ -76,7 +76,7 @@
The declaration of a library unit (including a
library_unit_renaming_declaration) is hidden from all visibility except at
places that are within its declarative region or within the scope of a
-nonlimited_with_clause that mentions it. The limited view of a library package
+nonlimited_with_clause that mentions it. The limited view of a library package
is hidden from all visibility except at places that are within the scope of a
limited_with_clause that mentions it but not within the scope of a
nonlimited_with_clause that mentions it.
@@ -90,9 +90,11 @@
Add after of 8.4(10):
o A potentially use-visible declaration is not visible if the place considered
- is within the scope of a limited_with_clause which mentions the package
- where the declaration occurs, and is more nested than the use_clause.
+ is within the scope of a limited_with_clause which:
+ - is more nested than the use_clause; and
+ - mentions the package where the declaration occurs; and
+ - is not more nested than a nonlimited_with_clause which names that package.
Replace 8.5.3(3) by:
@@ -102,7 +104,7 @@
Insert somewhere in 10.1.1(26):
A limited library package view declaration depends semantically upon the parent
-limited package view declaration. A library package declaration depends
+limited package view declaration. A library package declaration depends
semantically upon its limited view.
@@ -114,23 +116,18 @@
Add after 10.1.2(5):
-A with_clause is *more nested than* a context_item if they are both part of the
-same context_clause, or if the scope of the with_clause is entirely included in
-the scope of the context_item. Similarly, a with_clause is *more nested than* a
-use_clause occurring immediately within a declarative region, if the scope of
-the with_clause is entirely included in the scope of the use_clause.
+A with_clause is *more nested than* a context_item if the scope of the
+with_clause is (strictly) included in the scope of the context_item.
+Similarly, a with_clause is *more nested than* a use_clause occurring
+immediately within a declarative region, if the scope of the with_clause is
+included in the scope of the use_clause.
Replace 10.1.2(6) by:
A library_item is *named* in a with_clause if it is denoted by a
-library_unit_name in the with_clause. A library_item is mentioned in a
-nonlimited_with_clause if it is named in the with_clause or if it is denoted by
-a prefix in the with_clause. A library_item is mentioned in a
+library_unit_name in the with_clause. A library_item is *mentioned* in a
limited_with_clause if it is named in the with_clause or if it is denoted by a
-prefix in the with_clause, and that with_clause is not more nested than a
-nonlimited_with_clause that mentions the same library_item. A name mentioned in
-a limited_with_clause denotes the limited view of the corresponding library
-package.
+prefix in the with_clause.
Add after 10.1.2(8):
@@ -139,11 +136,16 @@
package_declaration[, not a subprogram_declaration, generic_declaration,
generic_instantiation, or package_renaming_declaration].
-A limited_with_clause which names a library_item shall not be more nested than
-a nonlimited_with_clause which mentions the same library_item.
-
A limited_with_clause shall not appear on a library_unit_body or subunit.
+A limited_with_clause which names a library_item shall not be:
+
+o part of the same context_clause as a nonlimited_with_clause which mentions
+ the same library_item; or
+
+o more nested than a nonlimited_with_clause which mentions the same
+ library_item.
+
Add after 10.1.4(2):
@@ -163,8 +165,8 @@
the corresponding library_package_declaration.
There is no syntax for declaring limited package views, because they are always
-implicit. A limited package view is _not_ the declaration of a library unit
-(the library_package_declaration is). Nonetheless, the declaration of a
+implicit. A limited package view is _not_ the declaration of a library unit
+(the library_package_declaration is). Nonetheless, the declaration of a
limited package view is considered to be a library_item.
A library_package_declaration is considered to be the completion of its limited
@@ -183,25 +185,25 @@
!discussion
It is natural to think of a with_clause as causing a library unit to
-become visible. However, that's not what the RM says. Instead, the RM
+become visible. However, that's not what the RM says. Instead, the RM
says that *lack* of a with_clause causes a library unit *not* to be
-visible. That's kind of odd, but to understand the wording below, you
-have to understand the existing model in this language-lawyerly fashion.
+visible. That's kind of odd, but to understand the wording, you have to
+understand the existing model in this language-lawyerly fashion.
The current RM defines the notion of an "environment declarative_part".
During compilation, this fanciful declarative_part is imagined to
-contain all the library_items of interest. The order of these
+contain all the library_items of interest. The order of these
library_items is such that there are no forward semantic dependences.
With_clauses introduce semantic dependences, so they control the order.
Semantic dependences are also caused by child-parent and body-spec
-relationships. Subunits are imagined to be "inlined" at their stub
+relationships. Subunits are imagined to be "inlined" at their stub
point, so subunits can be ignored for visibility purposes.
The visibility rules for library units come from treating the
environment declarative_part in the usual way, with one difference: In a
normal declarative_part, you can see everything that comes before, and
nothing that comes after (with a bunch of hiding rules thrown in as
-well). In the environment declarative_part, however, you can see things
+well). In the environment declarative_part, however, you can see things
that come before, but only if mentioned in a with_clause.
Similar oddities occur in the definition of "immediate scope" and
@@ -216,24 +218,10 @@
We need to define the nesting of with_clauses relative to each other and to
use_clauses to phrase a number of rules that describe the interaction between
use_clauses and nonlimited_ and limited_with_clauses appearing on different
-units. Note that a with_clause is more nested than itself (not that it matters
-much, but it make some of the wording simpler).
+units.
-For nonlimited_with_clauses, the new 10.1.2(26) doesn't change the current RM.
-For limited_with_clause, it says that if for instance the specification of Q
-has a "with P" and the specification of Q.C has a "limited with P.R.S" then P
-is not mentioned in the limited_with_clause. So the limited_with_clause has no
-effect for P; in particular it doesn't revert to the limited view of P. On the
-other hand, it makes the limited views of P.R and P.R.S visible. This is mostly
-a methodological restriction, as we have (pathological) cases where the limited
-view "reemerges". However, we want to make such cases infrequent to avoid
-confusing users.
-
The changes to 10.1.2(8) ensure that, if for instance the specification of Q
-has a "with P.R", it shall not have a "limited with P" or a "limited with P.R".
-The same applies to the children of Q. On the other hand, a "limited with
-P.R.S" is fine. Again this is to avoid reemergence of the limited view as much
-as possible.
+has a "with P.R", it shall not have a "limited with P" or a "limited with P.R". The same applies to the children of Q. On the other hand, a "limited with P.R.S" is fine.
The fact that a "limited with P" hides the full view of P from all visibility
prevents ripple effects. If you are is the scope of a "limited with P", the
@@ -257,7 +245,7 @@
analysis.
To simplify implementation and avoid funky Beaujolais effects, use clauses are
-not allowed to mention a limited view of a package. Consider the example
+not allowed to mention a limited view of a package. Consider the example
below; if the use clauses were legal, changing the "with A" to "with B" would
silently change the meaning of X in P.C:
@@ -280,9 +268,9 @@
Y : Integer := X;
end P.C;
-Furthermore, use clauses are inherited from the parent unit. This may be used
+Furthermore, use clauses are inherited from the parent unit. This may be used
to construct a situation where a limited_with_clause occurs in the scope of a
-use_clause for the same unit. For example:
+use_clause for the same unit. For example:
with A;
package P is
@@ -328,7 +316,7 @@
If you nest (in that order) (1) a use_clause, (2) a limited_with_clause and (3)
a nonlimited_with_clause, then the limited_with_clause effectively cancels the
-use_clause, but the nonlimited_with_clause doesn't reestablish it. Again,
+use_clause, but the nonlimited_with_clause doesn't reestablish it. Again,
that's to prevent Beaujolais effects.
A limited view of a package cannot be mentioned in a package renaming
@@ -340,8 +328,8 @@
best left unanswered.
We do not allow a limited_with_clause to mention a procedure, because that
-would allow calling a procedure before its spec is elaborated. The language
-has no mechanism to deal with that. Similarly, we do not allow a
+would allow calling a procedure before its spec is elaborated. The language
+has no mechanism to deal with that. Similarly, we do not allow a
limited_with_clause to mention a generic, because that would allow
instantiating a generic before its spec is elaborated.
@@ -402,6 +390,16 @@
dereference would be legal even though it would be in the declarative region of
the incomplete type T.
+Presuming that AI 262 is adopted, limited_with_clauses also combine with
+private_with_clauses, with the following syntax:
+
+ limited private with P;
+
+Such a clause give visibility on the private view of P, but only at the
+beginning of the private part of the package where it appears. (The wording
+sections of AI 217 and AI 262 will obviously need to be merged when building
+the Draft International Standard.)
+
!example
!ACATS test
@@ -3549,7 +3547,7 @@
-----------------
Thoughts on the implementation of "limited with" in AdaMagic
- $Revision: 1.7 $ $Date: 2003/09/19 01:42:29 $
+ $Revision: 1.8 $ $Date: 2003/09/23 03:47:49 $
The "limited with" clause makes a "limited view"
of a package visible in the compilation unit
@@ -5358,7 +5356,7 @@
-----------------
Thoughts on the implementation of "limited with" in AdaMagic
- $Revision: 1.7 $ $Date: 2003/09/19 01:42:29 $
+ $Revision: 1.8 $ $Date: 2003/09/23 03:47:49 $
The "limited with" clause makes a "limited view"
of a package visible in the compilation unit
Questions? Ask the ACAA Technical Agent