To: J3 J3/23-151 From: Van Snyder Subject: A[w] and AT format for objects of enumeration type Date: 2023-March-25 References: 23-007 Introduction ------------ The only input/output method to transfer data for objects of enumeration type is integer editing. They are not permitted with list-directed editing. Clause 12 and subclause 13.11 are silent about whether they are permitted for namelist editing. Input/output of objects of enumeration type therefore isn't any different from the situation in Fortran 77. One still needs to instruct users "Use 1 for red, 2 for green, 3 for blue." But it does preserve "Fortran's beloved tacked on look" and the tradition of half-measures that result in programs being littered with kludges to cope with incomplete features. Proposal -------- Allow list-directed and namelist editing for input and output of objects of enumeration (not enum) type. Allow A[w] editing for input and output, and AT editing for output, of objects of enumeration (not enum) type. Suggested edits --------------- These suggested edits to 23-007 are provided only to estimate the scope of the editorial project. Implementation would be complicated by the possibility to need tables of enumerator names in each scoping unit, or at least tables that override pieces of tables the processor brings into the scoping by use association, in case one they are renamed during use association. [242:3-4 12.6.3p6 Data transfer input/output list] Replace the paragraph: "A list item that is of an enumeration type in a formatted data transfer statement shall correspond to an A, AT, I, B, O, or Z edit descriptor, except that such an input item shall not correspond to an AT edit descriptor." [281:18-20 13.7.4p1 Character editing] Insert "or enumeration type" after "type character" twice. Insert "or data of enumeration type" after "character data". [281:22+ 13.7.4p1+ Character editing] Insert a paragraph: "The character length for an output item of enumeration type is the number of characters in its local name. The character length for an input item of enumeration type is the greatest number of characters in the local names of all enumerators of the type." [281:26 13.7.4p3 Character editing] Replace "the effective item" with "an effective item of type character." [281:29+ 13.7.4p3+ Character editing] Insert a paragraph: "If the effective input item is of enumeration type the length of the input item shall not be greater than . The value of an output item is the local name of the enumerator. The case of the output value is processor dependent. The numeric value of the input item becomes the numeric value of the enumerator whose local name is the same as the input value, without regard to case." [288:35+ 13.10.3.1p9+ List-directed input forms] Insert a paragraph: "When the next effective item is of enumeration type, the input form consists of the local name of an enumerator of the type. The numeric value of the input item becomes the numeric value of the enumerator whose local name is the same as the input value, without regard to case." [290:20+ 13.10.4p7+ List-directed output] Insert a paragraph: "The character sequence for output of an object of enumeration type is the local name of the enumerator. The case of the output value is processor dependent." [293:14+ 13.11.3.3p8+ Namelist input values] Insert a paragraph: "When the next effective item is of enumeration type, the input form consists of the local name of an enumerator of the type. The numeric value of the input item becomes the numeric value of the enumerator whose local name is the same as the input value, without regard to case." [294:16+ 13.11.4.2p1+ Namelist output editing] Nothing is needed here because "namelist output records are edited as for list-directed output." [552:2+ A.2 Processor dependencies] Insert a list item: " o the case of output of objects of enumeration type (13.7.4); [552:9+ A.2 Processor dependencies] Insert a list item: " o the case of output of objects of enumeration type (13.10.4); Related useful addition ----------------------- It would be useful to have a CASE changeable mode to specify the case of variable names in namelist output, and the case of enumeration type names in namelist and list-directed output. Values might be "UPPER", "LOWER", or "PROCESSOR_DEPENDENT". There ought to be no controversy here about what "upper case" and "lower case" might mean, which was the argument used against intrinsic functions for case conversion because those terms are difficult to define for ISO 10646 data.