AI22-0035-1

!standard A.4.3(109)                                    22-04-25  AI22-0035-1/02

!standard A.4.3(8.2/2)

!standard A.4.3(10)

!standard A.4.3(14)

!standard A.4.3(20)

!standard A.4.3(21)

!standard A.4.3(56.1/2)

!standard A.4.3(57)

!standard A.4.3(63)

!standard A.4.3(69)

!standard A.4.3(71)

!standard A.4.4(43.2/2)

!standard A.4.4(45)

!standard A.4.4(49)

!standard A.4.4(55)

!standard A.4.4(56)

!standard A.4.5(38.2/2)

!standard A.4.5(40)

!standard A.4.5(44)

!standard A.4.5(50)

!standard A.4.5(51)

!class binding interpretation 22-01-26

!status Corrigendum 1-2022  22-05-05

!status ARG Approved  13-0-0  22-05-05

!status work item 22-01-26

!status received 22-01-26

!priority Low

!difficulty Easy

!qualifier Omission

!subject Add "not null" to some Ada.Strings subprograms

!summary

As a binding interpretation, add "not null" to various subprograms with Character_Mapping_Function parameters in the Ada.Strings hierarchy.

!issue

Only in fine print does it say that passing in a null Character_Mapping_Function will result in a Constraint_Error (specifically, in A.4.3(109)). We could add "not null" to the parameter profiles where Character_Mapping_Function is used and is required to be nonnull, which would

be clearer. Should we do this? (Yes.)

!recommendation

(See Summary.)

!wording

In A.4.3(8.2/2, 10, 14, 20, 21, 56.1/2, 57, 63, 69, 71), modify:

     Mapping : in {not null }Character_Mapping_Function ...

 

In A.4.4(43.2/2, 45, 49, 55, 56), modify:

     Mapping : in {not null }Character_Mapping_Function ...

 

In A.4.5(38.2/2, 40, 44, 50, 51), modify:

     Mapping : in {not null }Character_Mapping_Function ...

 

!discussion

Adding "not null" directly to the formal parameter definitions minimizes incompatibility, as such formal subprograms will still match the profiles without the "not null" for the purposes of renaming-as-declaration and passing as an actual subprogram to generic formal subprograms.

However, not all of the incompatibility is eliminated, as uses that require subtype conformance will still fail to match. In particular, the prefix of 'Access, and renames-as-body in a body require subtype conformance.

Because these cases of incompatibility seem fairly unlikely, after discussion among the ARG, it was decided to make this change a binding interpretation, rather than having this subtle distinction between different versions of Ada.

!ACATS test

No additional ACATS tests should be necessary. One could imagine adding a

B-Test for the incompatibility for 'Access and renames-as-body, but those

cases seem unlikely enough to make such a test a near-pathology.

!appendix

From: Tucker Taft

Sent: Friday, June 18, 2021  9:06 AM

An issue came up with the fact that only in fine print does it say that

passing in a null Character_Mapping_Function will result in a

Constraint_Error (e.g. A.4.3(109)).  It would seem appropriate to add a

"not null" to the parameter profiles where Character_Mapping_Function is

used and is required to be nonnull.  Changing the type itself to be null

excluding would be incompatible, but adding "not null" to the various

parameters would communicate the information as part of the subprogram

contract.

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