To: J3 J3/24-128r3 From: generics Subject: Miscellaneous edits to incorporate templates Date: 2024-June-26 References: 24-125, 24-126, 24-127 1. Introduction =============== This paper describes many edits to the standard that will be required in order to incorporate the syntax and semantics for templates. this is not intended to be an exhaustive listing, but describes those that have been identified so far. 2. Edits required for deferred arguments ======================================== * Insert new glossary term in 3.7 [deferred argument association] association between an instantiation argument and a deferred argument (Sec. ?) * Insert new glossary term [deferred argument] named entity that appears in a (Sec. ?) * Insert new glossary term 3.34.x [deferred constant] a deferred argument with the PARAMETER attribute [instantiation argument] argument to an INSTANTIATE statement or inline instantiation * 7.3.2.1 Type specifier syntax Extend R702 : " <> " Extend C703 from: (R702) The shall not specify an abstract type (7.5.7) To: (R702) The or shall not specify an abstract type (7.5.7) except when used as an . Extend R703 to include: <> TYPE() <> CLASS() Change C706 from: (R703) TYPE() shall not specify an abstract type (7.5.7). To: (R703) In a that uses the TYPE keyword, or shall not specify an abstract type (7.5.7). Extend C705 from: (R703) In a that uses the CLASS keyword, shall specify an extensible type (7.5.7). To: (R703) In a that uses the CLASS keyword, or shall specify an extensible type (7.5.7). * 7.5.2.1 Syntax of a derived-type definition New constraint on R728: " shall not be a . * 8.5.2 Accessibility attribute Change C817 to read as An access-spec shall appear only in the specification-part of a module or template construct. * 8.6.1 Accessibility Statement Change C874 to read: C874 (R831) Each access-name shall be the name of a module, variable, procedure, nonintrinsic type, named constant, namelist group, requirement, or template. * 8.5.8.1 General Change last entry for From: <> To: <> * 8.5.8.2 Explicit-shape array Note: It may be better to modify to disambiguate for lower and upper bounds. This would make constraint for deferred constants clearer. * 8.5.8.6 Implied-shape array Modify the first sentence from: An implied-shape array is a named constant that takes its shape from the constant-expr in its declaration. To: An implied-shape array is a named constant that takes its shape from a constant expression. If it is a deferred constant, it takes its shape from the associated instantiation argument, otherwise it takes its shape from the constant expression in its declaration. Delete the first sentence in the last paragraph which reads: The extent of each dimension of an implied-shape array is the same as the extent of the corresponding dimension of the constant-expr. Add new section after 8.5.8.7 Assumed-rank entity, titled "Implied-rank entity". An implied-rank entity is an entity whose rank becomes defined only when the template in which it appears is instantiated. Note: Also make sure it works with SELECT GENERIC RANK and spell out what can be done with implied-rank entities. <> .. Constraint: An implied-rank entity shall be a . Examples of implied-rank entities TEMPLATE EXAMPLE(C, S, N) INTEGER, DEFERRED, PARAMETER :: C(..) ! implied-shape & implied-rank INTEGER, DEFERRED, PARAMETER :: S(*), N INTEGER, PARAMETER :: B(S) = 1 ! explicit-shape & implied-rank END TEMPLATE * 8.5.17 RANK clause Replace constraint C864 which states: An entity declared with a rank-clause shall be a dummy data object or have the ALLOCATABLE or POINTER attribute. With: An entity declared with a rank-clause shall be a named constant, dummy data object or have the ALLOCATABLE or POINTER attribute. Replace the last paragraph: If the rank is zero the entity is scalar; otherwise, if it has the ALLOCATABLE or POINTER attribute, it specifies that it is a deferred-shape array; otherwise, it specifies that it is an assumed-shape array with all the lower bounds equal to one. With: If the rank is zero the entity is scalar; otherwise, if it has the ALLOCATABLE or POINTER attribute, it specifies that it is a deferred-shape array; otherwise, if it is a named constant, it specifies that it is an implied-shape array with all lower bounds equal to one; otherwise, it specifies that it is an assumed-shape array with all the lower bounds equal to one. * 8.6.1 Accessibility statement Modify C873 to read as An shall appear only in the of a module or template construct. Only one accessibility statement with an omitted is permitted in the of a module or template construct. * 10.1.12 Constant expression Extend list in normative text for "constant expression": "deferred constant" * 10.1 Expressions and Assignment New section 10.1.13 Deferred constant expressions <> An expression is a if one or more of its primaries is a deferred constant. A is not equal to any other unless is syntactically equivalent. * 11.1.11.1 Purpose and form of the SELECT TYPE construct Extend R1156 to R1156 <> TYPE IS ( ) [ ] <> CLASS IS ( ) [ ] <> CLASS IS ( ) [ ] <> CLASS DEFAULT [ ] Add constraint: (R1156) shall specify an extensible type. * 15.5.1 Syntax of a procedure reference UTI: spelling of vs Extend R1522 : " <> " " <> " Extend R1524 with: " <> " <> 3. Edits required for templates and instantiation ================================================= * 5.1 High level syntax Extend R508 to include: <>