To: J3 J3/24-165r2 From: generics Subject: Edits for TEMPLATES: REQUIREMENT and REQUIRE Date: 2024-October-29 References: 24-161, 24-162, 24-163, 24-164, 24-125r5, 24-126r4, 24-127r4 Introduction ============ This is the 5th of 6 papers that provide edits for the approved syntax for templates. Straw vote: The REQUIRE statement does not need "[::]" at this time, but we note that various other bits of the BNF also have unnecesary optional "[::]". E.g., various attribute specification statements: DIMENSION, INTENT, SAVE, ... Should "::" be removed from the BNF for the REQUIRE statement? YES - omit the optional "[::]" in the BNF NO - keep the optional "[::]" in the BNF ABSTAIN Note: Subgroup has made the following small change compared to the syntax paper to be more consistent with other Fortran keywords that are verbs: REQUIRES --> REQUIRE Section 1 ========= * Append the following at the end of clause 15 from paper 24-164. 15.7 REQUIREMENT construct A REQUIREMENT is a named collection of deferred argument declarations intended to facilitate reuse of common patterns within templates and other requirements. A REQUIREMENT construct is a specification construct. R1541 <> REQUIREMENT ( [] ) [ ] ... ... END [REQUIREMENT []] C1557a (R1541) A shall only appear in the of a main program or module. C1557b (R1541) Each shall appear as the name of an entity declared by a . C1558 (R1541) If a appears in the , it shall be identical to the specified in the . R1542 <> <> C1559 (R1542) shall include ABSTRACT or DEFERRED. NOTE 1 A is a scoping unit that allows use, host, and deferred argument association. {UTI: Change NOTE 1 to normative text?} NOTE 2 Each is local to the REQUIREMENT construct. NOTE 3 Examples of REQUIREMENT blocks: REQUIREMENT R1(U, V, G) DEFERRED TYPE :: U, V DEFERRED INTERFACE FUNCTION G(X) TYPE(U), INTENT(IN) :: X TYPE(V) :: G END FUNCTION END INTERFACE END REQUIREMENT REQUIREMENT R2(U, G) REQUIRE R1(U, U, G) END REQUIREMENT Example REQUIRE statements for the above requirements are shown below, which could appear together in the same template, although they are redundant in this case. REQUIRE R1(T, T, F) REQUIRE R2(T, F) 15.8 REQUIRE statement A REQUIRE statement provides specifications of deferred arguments by associating them with the deferred arguments of a REQUIREMENT. A REQUIRE statement is a specification statement. R1543 <> REQUIRE [::] ( [] ) C1559 (R1543) shall be the name of a previously defined REQUIREMENT. NOTE 1 Instantiation arguments in a REQUIRE statement are not required to be deferred arguments. NOTE 2 Within a nested template, host associated entities are not deferred arguments, and thus appearing as instantiation arguments in a REQUIRE statement does not give them specifications. ===END===