Version 1.2 of ai12s/ai12-0020-1.txt

Unformatted version of ai12s/ai12-0020-1.txt version 1.2
Other versions for file ai12s/ai12-0020-1.txt

!standard 6.1.1(0/3)          12-02-14 AI12-0020-1/01
!class Amendment 12-02-14
!status work item 12-02-14
!status received 11-10-13
!priority Medium
!difficulty Medium
!subject 'Image for all types
!summary
**TBD.
!proposal
Ada should provide 'Image for record and array types, using an aggregate format.
!wording
** TBD.
!discussion
Ada has a way to automatically create stream attributes and equality, so there is some sense to supporting a way to do that for 'Image as well. But care would be needed: some representation would be needed for access types, and do we want to support 'Value for complex records?
!ACATS test
** TBD.
!appendix

From: Gregory D Moncreaff
Sent: Thursday, October 13, 2011  6:59 PM

Having worked with other language technologies, specifically C# and Java, 

I was wondering if any consideration was being given to the idea of providing some form of
default rendering of record types via an attribute?

Typically one would expect it to report all components (recursively) of record using the
type primitive existing image attributes.

Access types would not be traversed to avoid recursion. Only the valid components of a
discriminated record would be reported.

Ideal format would be of something that could itself be used as a record assignment by
components.

Optionally providing the ability of overriding this attribute would be nice, but not necessary.

Special care would need to be taken if String's had special ASCII characters within them by
concatenating the quotable portions of the string with the specials.

Does this seem reasonable?

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

From: Randy Brukardt
Sent: Thursday, October 13, 2011  9:16 PM

...
>I was wondering if any consideration was being given to the idea of 
>providing some form of default rendering of record types via an 
>attribute?

Yes, of course. We've considered a number of additional forms of 'Image and 'Value. We never
got any consensus on whether they are important enough.
	
>Typically one would expect it to report all components (recursively) of 
>record using the type primitive existing image attributes.

In what format?? (Aggregates, presumably.) Why only records, why not arrays?
	
>Access types would not be traversed to avoid recursion. Only the valid 
>components of a discriminated record would be reported.

What gets output for a non-null access type parameter. Whatever it is, it wouldn't mean the
same thing in an aggregate, which is bad.
	
>Ideal format would be of something that could itself be used as a 
>record assignment by components.

What is this? An aggregate I can imagine, I don't even know what "record assignment by components"
means (I imagine a series of assignment statements when I read that, but I can't imagine how
you could use that as an 'Image).
	
>Optionally providing the ability of overriding this attribute would be 
>nice, but not necessary.

We've discussed this idea in the past, too. We also considered *only* providing this (see below
for why).
	
>Special care would need to be taken if String's had special ASCII 
>characters within them by concatenating the quotable portions of the 
>string with the specials.

A String is just an array in Ada, there is nothing special about it. And what about components
that are other arrays (arrays of integer, arrays of float, arrays of record)? Task components?
Protected type components?
	
>Does this seem reasonable?

Not particularly, for some of the reasons given above. As a built-in attribute, the compiler would
have to generate it for all types (whether it is used or not, since it can't know whether some
other package will use it). And given the recursive definition you are giving, it would become
very, very large for a lot of types (even stopping on access types). Imagine a record containing
a matrix component, for one example.

For a compiler (like Janus/Ada) that is designed to make small size code, this would be a
problem. (At least it would not have any runtime impact unless used.)
	
I do think there might be something worth doing for 'Image (I don't think we rejected it for
technical reasons as much as importance). But an automatically recursing 'Image isn't it, IMHO.

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

From: Simon Wright
Sent: Friday, October 14, 2011  2:23 AM

I was wondering if any consideration was being given to the idea of providing some form of
default rendering of record types via an attribute?

Gregory might find the ASIS-based  Auto_Text_IO useful - http://www.sigada.org/WG/asiswg/ASIS_Clients.html#Leake

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


Questions? Ask the ACAA Technical Agent