To: J3 J3/26-140 From: Tom Clune & generics Subject: Resolution of UTI010 Date: 2026-May-26 References: 26-007r1 Introduction: ------------- The UTI highlights that the provided example lacks sufficient witter and uses features that are introduced in later section. The UTI suggests instead to only have a simple example here and move the more complicated example down below. Subgroup agrees with these suggestions. Edits: ------ [400:8+] (16.3 Restriction on template definitions) Delete entirety of Unresolved Technical Issue 10. [401:1-] (16.3 Restriction on template definitions). Replace existing NOTE with: " This is an example of a TEMPLATE construct. TEMPLATE tmpl{t} DEFERRED TYPE :: t TYPE named_t CHARACTER (:), ALLOCATABLE :: name TYPE (t) :: value END TYPE END TEMPLATE " [406:15+] (16.5.1 The INSTANTIATE statement) Introduce new note: "NOTE This is an example of a template with multiple deferred arguments: TEMPLATE iterate_tmpl{t, n, f} PRIVATE PUBLIC :: iterate DEFERRED TYPE :: t DEFERRED, INTEGER, PARAMETER :: n DEFERRED INTERFACE TYPE(t) FUNCTION f(x) TYPE(t), INTENT (IN) :: x END SUBROUTINE END INTERFACE CONTAINS TYPE(t) FUNCTION iterate(x) TYPE(t), INTENT (IN) :: x INTEGER :: i iterate = x DO i = 1, n-1 iterate = f(iterate) END DO END SUBROUTINE iterate END TEMPLATE iterate_tmpl INTEGER FUNCTION increment(i) INTEGER, INTENT(IN) :: i increment = i + 1 END FUNCTION REAL FUNCTION times2(x) REAL, INTENT(IN) :: x times2 = 2*x END FUNCTION New functions can be produced by instantiating the template: INSTANTIATE iterate_tmpl{INTEGER,7,increment}, iterate => increment7 INSTANTIATE iterate_tmpl{REAL,4,times2}, iterate => times16 [406:21+] (16.5.2 The Inline instantiation of templated procedures) Introduce new note before the existing note: NOTE 1: This is an example of a templated procedure and inline instantation. It makes use of procedures 'increment' and 'times2' from the note in 16.5.1. TEMPLATE FUNCTION iterate {t, n, f} (x) DEFERRED TYPE :: t DEFERRED INTEGER, PARAMETER :: n DEFERRED INTERFACE TYPE(t) FUNCTION f(x) TYPE(t), INTENT (IN) :: x END SUBROUTINE END INTERFACE TYPE (t), INTENT (IN) :: x TYPE (t) :: iterate INTEGER :: i iterate = x DO i = 1, n-1 iterate = f(iterate) END DO END FUNCTION iterate INTEGER :: m REAL :: y m = iterate{INTEGER,7,increment}(10) ! yields 17 y = iterate{REAL,4,times2}(7.) ! yields 102 " [406:21+] (16.5.2 The Inline instantiation of templated procedures) Change the existing note to be Note 2. === END ===