To: J3 J3/21-179r2 From: Van Snyder & Malcolm Cohen Subject: Enumerator accessibility and constructor Date: 2021-October-25 Reference: 21-007r2 0. Response to proposals ------------------------ These are two technical proposals for new specs/syntax, and two questions. a. "Access-spec should be allowed on the " Response: There is no reason why this should be permitted on one ENUMERATOR statement and not the other. It would be slightly more convenient to be able to say, even for a BIND(C) enumeration, ENUMERATOR,PRIVATE :: a=100, b=200, c=300 instead of needing a separate access-stmt. Subgroup does not think that now is the time to add this feature. b. "Enumeration type constructors should allow enumerator expressions of the same type [for symmetry with the INT and REAL intrinsic functions]" Response: The reason for INT and REAL to accept arguments of the same type is that it is used to convert to different kinds. There is no such rationale for allowing an enumeration constructor to accept an enumeration expression, as it would be identical to just having the enumeration expression. c. "[Is the enumeration constructor elemental]?" Response: No, the text describing its effect does not permit that interpretation. Paper 21-182r1 makes this explicit. d. "Should TINY be allowed to have an argument of enumeration type, always returning the value 1?" Response: No. This would always have the value 1. We do not need an intrinsic function that always returns the value 1. 1. Discussion ------------- The access spec on the directly affects only the enumeration type name but indirectly specifies default accessibility for enumerator names. Access-spec should be allowed on the . The INT and REAL intrinsic functions allow arguments of the same type as the result. Enumeration type constructors should allow enumerator expressions of the same type. It should be explicitly specified whether the enumeration constructor is elemental. R771 appears to allow an elemental interpretation (because the "argument" is not ). 2. Edits -------- [91:7 Enumeration types R768] Replace the syntax rule "R768 <> ENUMERATOR [ [, :: ] " [91:13 7.6.2p2 Enumeration types] Replace "overridden by an " with "overridden by an on an , or an ". [91:13+ 7.6.2p2+ Enumeration types] Add a constraint "C7114a If the default accessibility of an enumerator is overridden by both an and an , the and shall specify the same accessibility." OR add a paragraph "If the default accessibility of an enumerator is overridden by in , that accessibility may be further overridden by an ." [91:21+ R771 7.6.2p2 Enumeration types] Add an alternative to the syntax rule , another syntax rule, and a constraint " <> " "R771a <> " "C7116a (R771) The type of shall be the same as the type specified by ". [91:22-24 7.6.2p5 Enumeration types] Replace the paragraph: "An enumeration constructor is elemental (3.66). It returns a value of the enumeration type whose ordinal position is the value of , or the value of . The value of shall be positive and less than or equal to the number of enumerators in the definition of the enumeration type." [529:20 19.2.1p3 Classes of local identifiers] After (7.5.10) insert "and enumerators of different enumeration types may have the same name. If enumerators of different enumeration types that have the same name are accessible in a scoping unit, they shall not appear within that scoping unit except as the in an ." 3. Question ----------- Should TINY be allowed to have an argument of enumeration type, always returning the value 1?