To: J3 J3/19-153 From: Robert Corbett Subject: Categories of elemental procedures Date: 2019-February-14 References: 18-007r1 ----------------------------------------------------------------- NUMBER: F18/011 TITLE: Categories of elemental procedures KEYWORDS: elemental DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTIONS: The list of categories of elemental procedures at the start of Subclause 15.8 "Elemental procedures" [325:11-12] is incomplete. Procedures that are defined to be elemental in intrinsic modules are not included. Type-bound procedures are not included. Dummy procedures and procedure pointers are not included, but there is evidence that those omissions were intentional. The standard intrinsic modules specify several procedures to be elemental. The omission of module procedures declared in intrinsic modules from the list in Subclause 15.8 creates a contradiction. Subclause 7.5.6.2 [80:5-8] and Subclause 7.5.7.3 [82:16] both assume that type-bound procedures may be elemental. Nonintrinsic elemental procedures cannot be used as actual arguments [301: 29, 15.5.1 "Syntax of a procedure reference" p1]. Elemental procedures specified in the standard inrinsic modules are generic, and so they cannot be passed as actual arguments. Elemental intrinsic procedures can be passed as actual arguments [309: 2-5, 15.5.2.9 "Actual arguments associated with dummy procedure entities" p1], but the text cited indicates that dummy procedures cannot elemental. Procedure pointers pose a bit of a problem. A nonintrinsic elemental procedure cannot be the target of a pointer assignment [165:34, 10.2.2.2 "Syntax of the pointer assignment statement" ]. However, paragraph 3 of Subclause 10.2.2.4 "Pointer procedue assignment" states If the pointer object has an explicit interface, its characteristics shall be the same as the pointer target except that the pointer target may be pure even if the pointer object is not pure and the pointer target may be an elemental intrinsic procedure even if the pointer object is not elemental. The final phrase suggests that a pointer object may be elemental, but it does not say that it can be elemental. Q1. Is a procedure in an intrinsic module that is specified to be elemental an elemental procedure? Q2. Can a type-bound procedure be elemental? Q3. Can a dummy procedure be specified to be elemental? Q4. Can a procedure pointer be specified to be elemental? ANSWERS: A1. Procedures in intrinsic modules that are specified to be elemental are elemental. An edit is provided to correct the omission in Subclause 15.8. A2. A type-bound procedure that is bound to an elemental procedure is elemental. An edit is provided to correct the omission in Subclause 15.8. A3. A dummy procedure cannot be specified to be elemental. An edit is provided to make this restriction explicit. A4. A procedure pointer cannot be specified to be elemental. An edit is provided to make this restriction explicit. The edits provided are intended to make the impact on the existing standard small. More extensive changes are probably desirable, and could be made in a revision of the standard. In particular, the restrictions on dummy arguments and procedure pointers could be made constraints. EDITS to 18-007r1: [167:8, 10.2.4.4 Procedure pointer assignment, p3] Replace "elemental intrinsic procedure even if the pointer object is not elemental." with "elemental intrinsic procedure, even though the pointer object is not elemental." { Remove the suggestion that a procedure pointer might be elemental. } [325:11-12, 15.8.1 Elemental procedure declaration and interface, p1] Replace the sentence "An elemental procedure is ... an elemental subprogram." with "An elemental procedure is * an elemental intrinsic procedure (16.1), * a module procedure in an intrinsic module, if it is specified to be elemental, * a procedure that is defined by an elemental subprogram, or * a type-bound procedure that is bound to an elemental procedure. A dummy procedure or procedure pointer shall not be specified to be ELEMENTAL." { Add missing items the list in Subclause 15.8. Add a missing restriction to Subclause 15.8. } SUBMITTED BY: Robert Corbett HISTORY: 19-nnn m218 Submitted