Version 1.1 of ai05s/ai05-0046-1.txt

Unformatted version of ai05s/ai05-0046-1.txt version 1.1
Other versions for file ai05s/ai05-0046-1.txt

!standard 6.3.2(18)          07-04-04 AI05-0046-1/01
!class binding interpretation 07-04-04
!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
(See recommendation.)
!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 explicit). 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 {either 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.
!ACATS test
An ACATS B-Test should be created to test these cases.
!appendix

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

Questions? Ask the ACAA Technical Agent