Version 1.2 of ais/ai-00381.txt

Unformatted version of ais/ai-00381.txt version 1.2
Other versions for file ais/ai-00381.txt

!standard 13.12.1 (0)          04-06-08 AI95-00381/01
!class amendment 04-06-08
!status work item 04-06-08
!status received 04-06-08
!priority Medium
!difficulty Easy
!subject New Restrictions identifier No_Dependence
!summary
A new Restrictions identifier is proposed to specify that there are no dependences on a given language-defined or implementation-defined package.
!problem
There are a number of Restrictions identifiers provided for disallowing dependence on one language-defined package or another. Rather than adding more of these identifiers piece-meal, it would seem to make sense to have a general No_Dependence restriction, identifying the restricted package by the expression associated with the restriction.
!proposal
(See wording.)
!wording
New section 13.12.1:
13.12.1 Restriction No_Dependence
Static Semantics
The following restriction_parameter_identifier is language defined:
No_Dependence
Specifies a language-defined or implementation-defined library unit on which there are no semantic dependences.
Name Resolution Rules
The expression of a No_Dependence restriction is expected to be of type Standard.String.
Legality Rules
The expression of a No_Dependence restriction shall be a static string expression. The value of the string shall correspond (in upper, lower, or mixed case) to the full expanded name of a language-defined or implementation-defined library unit.
Post-Compilation Rule
No compilation unit included in the partition shall depend semantically on the library unit identified by the static string expression.
!discussion
This restriction should reduce the need for having a separate restriction identifier for each potentially interesting language-defined library unit.
We considered using a name rather than a static string to identify the library unit, but the name could not be construed as an expression of any actual type, and the basic syntax of pragma Restrictions specifies the use of an expression after a restriction_parameter_identifier. Furthermore, using a name in some sense implies a dependence on the named unit, whereas the whole point is to avoid any dependence. A static string seems to have the right semantics for this purpose.
We could also consider supporting some kind of "wildcard" notation, such as "Ada.Wide_*". This would clearly depend on using a string rather than a name for the argument.
!example
pragma Restrictions(No_Dependence => "Ada.Command_Line");
-- Example of restriction on language-defined package
pragma Restrictions(No_Dependence => "System.RTS.Tasking");
-- Example of restriction on implemenation-defined package
!ACATS test
An ACATS test should be created for this pragma.
!appendix

From: Tucker Taft
Sent: Monday, June 7, 2004 11:48 PM

Here is my last homework assignment (I hope, and probably
so do you ;-).  It is a proposal to add a restriction-parameter
identifier "No_Dependence" whose expression is a static string
identifying a language-defined or implementation-defined
library unit.  No compilation unit in the partition may
have a semantic dependence on this library unit.

I chose to use a static string rather than an unquoted
name to conform to the basic syntax of
    restriction_parameter_identifier => expression
This decision is debatable.  See the !discussion for
a bit more rationale.

****************************************************************

From: Robert A Duff
Sent: Wednesday, June 9, 2004 10:30 AM

I don't care much one way or the other, but I suspect most users would
find the quotes to be superfluous.

Also, I wonder whether the string can contain blanks and other
whitespace:

    pragma Restrictions
        (No_Dependence => "Ada.     " & ascii.nl & " Command_Line");

I don't want to clutter the RM with rules forbidding such.
But when it comes to ascii.nl, whether that's whitespace might
be considered implementation dependent.

Does "Ada.Command_Line -- comment" correspond to a full expanded name?

Syntactically using a 'name' avoids worrying about such silliness.
I realize it might complicate the wording.

****************************************************************

Questions? Ask the ACAA Technical Agent