!standard 13.04 (04) 01-12-26 AI95-00281/01 !class amendment 01-12-26 !status No Action (7-0-0) 02-02-10 !status work item 01-12-26 !status received 01-12-11 !priority Low !difficulty Medium !subject Representation of enumeration type image attribute !summary (TBD.) !problem The image of an enumeration is not very flexible. It is not possible to have an image that is not a proper identifier, nor is the case of the image specifiable. !proposal Provide a mechanism for specifying the image of enumeration types. The Image attribute is specifiable. The specified item is an one-dimensional array aggregate, with the index subtype is the enumeration type, and each component expression is of type String. Each component expression must be static. (Specific wording changes TBD.) !discussion If this proposal is adopted, the meaning of Ada.Text_IO.Get and Put for enumeration types should be changed to output the specified Image for types with a specified Image. (Otherwise, implementations would have to add another pair of attributes like 'Identifier_Image and 'Identifier_Value in order to implement this routine, as the regular 'Image and 'Value could no longer be used. Claw uses 'Image to provide automatically labels to sets of radio buttons. In order to make pleasing labels, Claw has to convert the labels to Mixed case form, and replace '_' by spaces. Existing code like this (that assumes that the syntax of 'Image is that of an identifier or character literal) would break if given a type with a specified 'Image. !example type Currency is (Dollar, Pound, Euro) ; for Currency'Image use (Dollar => "$", Pound => "œ", Euro => "€") ; !ACATS test !appendix !topic Representation of enumeration type image attribute !reference RM95-13.3 !from Bernard Maudry !discussion Because of the limitations in the strings used as enumeration image, it would be very helpful to be able to specify the image attribute for enumeration types. The behavior of the value attribute will be changed accordingly. For example: type Currency is (Dollar, Pound, Euro) ; for Currency'image use (Dollar => "$", Pound => "œ", Euro => "€") ; (Sorry if the font you use does not provide the necessary characters). ************************************************************* From: Nick Roberts Date: Saturday, January 19, 2002 1:38 PM I disagree, since this could pose problems for the re-readability of enumerated types via Ada.Text_IO.Enumerated_IO in some implementations. For output, this kind of functionality is easily enough provided by an array. ************************************************************* From: Pascal Leroy Sent: Tuesday, January 22, 2002 5:11 AM An excellent point. Currently Enumeration_IO reads an identifier or character literal, and calls 'Value on the result. With the proposed change it would have to do a lot of work to know at what point it stops reading. (It would not be possible to write this in Ada without the addition of some extra capabilities, incidentally.) And I don't even want to consider the case where the image of one of the literals contains a line/page/file terminator ;-) ************************************************************* From: Bernard Maudry Sent: Tuesday, January 22, 2002 2:41 AM > I disagree, since this could pose problems for the re-readability of > enumerated types via Ada.Text_IO.Enumerated_IO in some implementations. For my understanding, can you give details about these problems? > For output, this kind of functionality is easily enough provided by an > array. Yes, but then, there are two representations managed for the same information, adding complexity which certainly lead to mistakes. Forcing the image attribute representation is a safety point, which allows to use the standard feature in confidence. *************************************************************