Version 1.1 of ai12s/ai12-0124-1.txt

Unformatted version of ai12s/ai12-0124-1.txt version 1.1
Other versions for file ai12s/ai12-0124-1.txt

!standard 3.5(31/2)          14-08-11 AI12-0124-1/01
!class Amendment 14-08-11
!status work item 14-08-11
!status received 14-08-08
!priority Low
!difficulty Easy
!subject Add Object'Image
Allow the prefix of the Image attribute to be an object.
GNAT has the attribute Obj'Img, which is very useful for debugging and testing as it does not require looking up the name of the subtype of Obj. This is commonly used in GNAT programs. Standard Ada should have something similar.
(See Wording.)
Add somewhere in 3.5: (Note that the attribute list doesn't appear to be in any obvious order, so perhaps these are best added at the tail end.)
For a prefix X that denotes an object of a scalar type: X'Image Denotes the result of calling function S'Image on X, where S is the
nominal subtype of X.
[Note: In the unlikely event that AI12-0123-1 was approved, this deescription could be simplified to: X'Image Denotes the result of the subprogram call X'Subtype'Image(X).]
Similar wording is needed for X'Wide_Image and X'Wide_Wide_Image.
We use an overloading of the existing attribute Image rather than following GNAT's lead of Img. Our understanding is that GNAT used Img rather than Image simply because 4.1.4(12/1) requires that implementation-defined attributes have different names than language-defined ones. Moreover, Ada generally does not use abbreviations, and this abbreviation would only save two characters.
This addition is compatible, as subtypes do not allow overloading. Thus, if an object X hides a subtype X, X'Image is currently illegal (and this would be a straight extension). If a subtype X hides an object X, no change would occur.
This should be implementable, as the Size attribute already allows both subtypes and objects as the prefix.
Note that the prefix of an attribute has to be a name, but any expression can be wrapped in a qualification or type conversion in order to make it a name. (Of course, in that case, the advantage of not having to know the subtype name has disappeared.)
No ASIS impact.
!ACATS test
An ACATS C-Test is needed to verify that the attributes are implemented as specified.


Questions? Ask the ACAA Technical Agent