Version 1.7 of ai05s/ai05-0046-1.txt
!standard 6.3.2(18) 07-10-08 AI05-0046-1/03
!class binding interpretation 07-04-04
!status Amendment 201Z 08-11-26
!status WG9 Approved 07-11-08
!status ARG Approved 10-0-1 07-06-03
!status work item 07-04-04
!status received 07-04-04
!priority Medium
!difficulty Easy
!qualifier Clarification
!subject Null exclusions must match for profiles to be fully conformant
!summary
For profiles to be fully conformant corresponding parameters
must match with respect to null exclusions.
!question
Consider:
package P is
type T is tagged null record;
procedure Something (P : access T);
end P;
package body P is
procedure Something (P : not null access T) is ...
end P;
Do the specification and body of P conform? The rules appear to say that they do.
Full conformance requires static matching for subtypes, and static matching
requires that both subtypes exclude null (4.9.1(2/2)). 3.10(13.1/2) says that
both of these subtypes exclude null (the top one because it is controlling, the
bottom one because it says so explicitly). Ergo, these match.
!recommendation
The example shown in the question is an unintended consequence of the rules: we want
to prevent misleading constructs that hamper understanding of the code without bringing
any benefits. Therefore, we require that the null exclusions match.
!wording
Modify 6.3.1(18) as follows:
Two profiles are fully conformant if they are subtype-conformant, and corresponding
parameters have the same names and {both or neither have null_exclusions and
they} have default_expressions that are fully conformant with one another.
!discussion
We do not require users to put "not null" on controlling parameters, but that's mostly
because of compatibility. We expect that a number of projects will actually require
explicit null_exclusions on a controlling parameter. At any rate, regardless of the
policy of a project, is seems silly to adopt different conventions for the specification
and the body, especially considering that in practice one is often obtained by a
simple copy-and-paste from the other.
Moreover, unlike the "in" parameter mode, there is a maintenance hazard with the current
rule. If the "tagged" reserved word is removed from the example, the completion no longer
conforms and is illegal. Similarly, if the subprogram is moved so that it is not primitive,
the completion is illegal.
for all of these reasons, we require exact matching of null_exclusions for full conformance.
!corrigendum 6.3.1(18)
Replace the paragraph:
Two profiles are fully conformant if they
are subtype-conformant, and corresponding parameters
have the same names and have default_expressions
that are fully conformant with one another.
by:
Two profiles are fully conformant if they
are subtype-conformant, and corresponding parameters
have the same names and both or neither
have null_exclusions and they have default_expressions
that are fully conformant with one another.
!ACATS test
An ACATS B-Test should be created to test these cases.
!ASIS
No change needed.
!appendix
****************************************************************
Questions? Ask the ACAA Technical Agent