CVS difference for ais/ai-00381.txt
--- ais/ai-00381.txt 2005/01/07 03:07:45 1.8
+++ ais/ai-00381.txt 2005/04/13 05:37:19 1.9
@@ -1,4 +1,4 @@
-!standard 13.12 (4) 04-11-09 AI95-00381/03
+!standard 13.12 (4) 05-03-28 AI95-00381/04
!standard 13.12.1 (1)
!class amendment 04-06-08
!status Amendment 200Y 04-06-29
@@ -13,15 +13,15 @@
!summary
A new Restrictions identifier is proposed to specify that there are no
-dependences on a given language-defined package.
+dependences on a given library unit.
!problem
There are a number of Restrictions identifiers provided for disallowing
-dependence on one language-defined package or another. Rather than
+dependence on one language-defined unit or another. Rather than
adding more of these identifiers piece-meal, it would make sense to
have a general No_Dependence restriction, identifying the restricted
-package by the expression associated with the restriction.
+unit by the expression associated with the restriction.
!proposal
@@ -29,13 +29,6 @@
!wording
- Change 13.12(4) to:
-
- restriction ::= restriction_identifier
- | restriction_parameter_identifier => restriction_parameter_argument
-
- restriction_parameter_argument ::= name | expression
-
New section 13.12.1:
13.12.1 Restriction No_Dependence
@@ -48,15 +41,24 @@
Specifies a language-defined library unit on which there
are no semantic dependences.
- Name Resolution Rules
+ Legality Rules
- The restriction_parameter_argument of a No_Dependence restriction shall be
- a name that corresponds to the full expanded name of a language-defined library unit.
+ The expression of the restriction_parameter_argument of a No_Dependence
+ restriction shall have the form of a full expanded name of a library unit.
+ AARM Note: This expression is not resolved; it is just a sequence of
+ identifiers. There is no requirement for any of the identifiers to be
+ defined in this unit or elsewhere.
+
Post-Compilation Rule
No compilation unit included in the partition shall depend semantically
- on the library unit identified by the name.
+ on the library unit identified by the expression.
+
+ AARM Note: There is no requirement that the library unit actually exist.
+ One possible use of the pragma is to prevent the use of
+ implementation-defined units; when the program is posted to a different
+ compiler, it is perfectly reasonable that no unit with the name exist.
!discussion
@@ -67,22 +69,32 @@
would allow a "wildcard" notation (like "Ada.Wide_*"), and would require less
changes to the existing language. But it was just too unnatural.
+We also considered limiting the name to just language-defined units. This
+was rejected because there are very many language-defined units
+(Numerics.Long_Long_Long_Long_Long_Long_Complex_Types is a language-defined
+unit, although it's unlikely that any implementation would have one), so there
+would a considerable burden to check that the unit is in fact a
+language-defined one.
+
+In addition, the restriction is very useful for eliminating dependence on
+implementation-defined (and user-defined) library units. For instance, a
+GNAT user might use
+ pragma Restrictions (No_Dependence => GNAT);
+to avoid dependence on the GNAT-specific libraries. It makes no sense to force
+implementations in invent a similar but different restriction for this purpose.
+
+There is one slightly unpleasant side-effect of allowing any unit. A typo in
+the name of a unit might go undetected, because there wouldn't be a dependence
+on the badly spelled unit (which is fine). That is essentially the same as
+a unit that doesn't exist because it isn't defined by the current
+implementation, so there is no way to detect it. But this doesn't seem
+important enough to deny a useful capability to users.
+
!example
pragma Restrictions(No_Dependence => Ada.Command_Line);
-- Example of restriction on language-defined package
-!corrigendum 13.12(4)
-
-@drepl
-@xcode<@fa<restriction ::= >@ft<@i<restriction>>@fa<_identifier
- | >@ft<@i<restriction_parameter>>@fa<_identifier =@> expression>>
-@dby
-@xcode<@fa<restriction ::= >@ft<@i<restriction>>@fa<_identifier
- | >@ft<@i<restriction_parameter>>@fa<_identifier =@> restriction_parameter_argument
-
-restriction_parameter_argument ::= name | expression>>
-
!corrigendum 13.12.1(1)
@dinsc
@@ -91,18 +103,18 @@
The following @i<restriction_parameter>@fa<_identifier> is language defined:
@xhang<@xterm<No_Dependence>
-Specifies a language-defined library unit on which there are no semantic dependences.>
+Specifies a library unit on which there are no semantic dependences.>
-@i<@s8<Name Resolution Rules>>
+@i<@s8<Legality Rules>>
-The @fa<restriction_parameter_argument> of a No_Dependence restriction shall be
-a name that corresponds to the full expanded name of a language-defined
-library unit.
+The @fa<expression> of the @fa<restriction_parameter_argument> of a
+No_Dependence restriction shall have the form of a full expanded
+name of a library unit.
@i<@s8<Post-Compilation Rules>>
No compilation unit included in the partition shall depend semantically
-on the library unit identified by the @fa<name>.
+on the library unit identified by the @fa<expression>.
!ACATS test
Questions? Ask the ACAA Technical Agent