To: J3 J3/24-165r1 From: generics Subject: Edits for TEMPLATES: REQUIREMENT and REQUIRE Date: 2024-October-22 References: 24-161, 24-162, 24-163, 24-164, 24-125r5, 24-126r4, 24-127r4 Introduction ------------ This is the 5th of 5 papers that provide edits for the approved syntax for templates. 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 20 from paper 24-164. 20.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. R2041 <> REQUIREMENT ( [] ) [ ] ... ... END [REQUIREMENT []] C2057a (R2041). A shall only appear in the of a main program or module. C2057b (R2041). Each shall appear as the name of an entity declared by a . C2058 (R2041). If a appears in the , it shall be identical to the specified in the . Note: A is a scoping unit that allows use, host, and deferred argument association. Note: Each is local to the REQUIREMENT construct. R2042 <> <> C2059 (R2042). shall include ABSTRACT or DEFERRED. Note: Examples of REQUIREMENT blocks: REQUIREMENT R1(U, V, G) TYPE, DEFERRED :: 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) 20.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. R2043 <> REQUIRE [::] ( [] ) C2059 (R2043). shall be the name of a previously defined . Note: Instantiation arguments in a REQUIRE statement are not required to be deferred arguments. Note: 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===