Visibility of character literals. 85-09-16 AI-00390/00 1 !standard 04.02 (05) 85-09-16 AI-00390/00 !class study 85-09-16 (provisional classification) !status received 85-09-16 !topic Visibility of character literals. !summary 85-09-16 !question 85-09-16 !recommendation 85-09-16 !wording 85-09-16 !discussion 85-09-16 !appendix 85-09-16 ****************************************************************************** !section 04.02 (05) MT Perkins/BDM 85-03-07 83-00643 !version 1983 !topic Visibility of character literals. I would like to point out an area of ambiguity in the Ada language standard and suggest a related change to the standard. The ambiguity is illustrated by the Ada program shown below. I believe this program is correct according to the standard. It fails to compile on the Data General/Rolm compiler, however, producing the error shown in the program. I have shown this listing to Data General Software Support. They maintain that the compiler is behaving according to the standard. They cite Section 4.2 Paragraph 5 of the Ada Language Reference Manual, which states that the character literals correspoinding to the characters contained within a string literal must be visible at the place of the string literal. They say that this paragraph implies that a Use Statement must be included in the program to make the character type directly visible. I believe that the renaming type declaration in line 11 of the example should suffice to make the character type in the string literal visible, and therefore the program should compile. My preferred solution to this problem would be to remove Section 4.2 Paragraph 5 from the language standard. It makes protecting the visibility of a character data type awkward. In lieu of deleting Section 4.2 Paragraph 5, making the character type visible by renamin the type is preferable to a Use Statement, since other objects in the package remain not directly visible. A member of my staff gave a copy of this program to Jerry Fisher at the recent SIGAda meeting in San Jose. Mr. Fisher requested that we also send AJPO a letter describing the problem. This letter is the result. Thank you. procedure ptest is Visibility of character literals. 85-09-16 AI-00390/00 2 type roman_digit is ('I','V','X','L','C','D','M'); -- 3-14 type roman is array (positive range <>) of roman_digit; -- 3-28 ninty_six : constant roman := "XCVI"; -- 3-32 package dd is -- Data Dictionary type roman_digit2 is ('I','V','X','L','C','D','M'); type roman2 is array (positive range <>) of roman_digit2; ninty_six2 : constant roman2 := "XCVI"; -- 3-32 end dd; subtype roman_digit2 is dd.roman_digit2; subtype roman2 is dd.roman2; thirty : constant roman := "XXX"; thirty2 : constant roman2 := "XXX"; ==> THIRTY2 : constant ROMAN2 := "XXX"; *** ROMAN2 literal "XXX" contains 'X', which is not in type ROMAN_DIGIT2 (line 6). *** ROMAN2 literal "XXX" contains 'X', which is not in type ROMAN_DIGIT2 (line 6). *** ROMAN2 literal "XXX" contains 'X', which is not in type ROMAN_DIGIT2 (line 6). begin null; end ptest;