To: J3 J3/22-114 From: Van Snyder Subject: First Enumerator in an enumeration type should allow a value. Date: 2022-February-03 Reference: 22-007 Comments on 7.6.2 Enumeration types =================================== If should be allowed to specify a numeric constant value for the first enumerator in an enumeration type. Thereby, enumerators can be used as subscripts in dimensions whose lower bounds are not 1. The description of the limits for the argument for the type constructor (7.6.2p5), the effect of input/output editing (13.7.2.2p6), and the value of the INT intrinsic function (16.9.110), would need to be revised. TINY would need to be defined for enumeration-type values, and its value would need to be the first enumerator of the type. Thereby, one could write enumeration type :: T .... type(t) :: E .... integer :: X(tiny(e):huge(e)) .... print *, x(e) Is there a technical reason that an access-spec is not allowed on an ENUMERATOR statement? The obvious semantics would be that it overrides the access-spec on the ENUMERATION statement, and applies to all the enumerators declared in that statement. For consistency with other entities that can have an access-spec in their declarations, appearance of their name in an access-stmt prevails. Enumeration types should be extensible, but that can be added compatibly in a later revision. Input/output of enumeration-type objects should use their local names, not their integer values. This can be added compatibly in a future revision, using the A edit descriptor. There seems to be no reason that enumeration-type namelist group objects are probibited. Did J3 just run out of time to define it? There seems to be no reason that list directed input/output is prohibited for enumeration-type variables. Did J3 just run out of time to define it? Proposed edits ============== Numeric value of first enumerator --------------------------------- [91:11 R768 7.6.2 Enumeration types] Replace "" with " [= ] [, ] ..." [91:11+ R768+ 7.6.2 Enumeration types] Insert a constraint "C7114a (R768) The may appear only in the declaration of the first enumerator of the type." [91:19 7.6.2p3 Enumeration types] Replace "ordinal position" with "numeric value". Append a sentence "If does not appear in the declaration of the first enumerator of the type, its numeric value is 1; otherwise, its numeric value is the value of . The numeric value of each successive enumerator is one more than the numeric value of the preceding enumerator." [91:26-28 7.6.2p5 Enumeration types] Replace the paragraph: "An enumeration constructor returns the value of the object of enumeration type whose numeric value is the value of the scalar-int-expr. The scalar-int-expr shall have a value that is greater than or equal to the numeric value of the first enumerator of the type, and less than or equal to the numeric value of the last enumerator of the type." [162:18 10.1.5.5.1p9 Interpretation of relational intrinsic operations] Replace "ordinal" with "numeric". [Here, "ordinal position" (not "ordinal value") would continue to work. But it would be the only place where "ordinal" appears.] [278:4-6 13.7.2.2p6 Integer editing] Replace "ordinal position" with "numeric value" twice, in the first and last sentences. Replace "positive and less than or equal to the number of enumerators" with "the numeric value of an enumerator of the type of the input item". [404:6 16.9.110p6 INT] Replace "ordinal position" with "numeric value". Access-spec for enumerators --------------------------- [91:11 R768 7.6.2 Enumeration types] Replace "[ :: ]" with "[ [ , ] :: ]" [91:16 7.6.2p2 Enumeration types] After "enumerators" insert "The on an ENUMERATOR statement specifies the accessibility of each declared by that statement, and overrides any default accessibility specified by an in the ENUMERATION TYPE statement."