09-307 To: J3 Members From: Stan Whitlock Subject: J3 Fortran interp letter ballot #20 - due 18-Dec-2009 Date: 2009 November 13 Enclosed in the next letter ballot on Fortran interpretations. The rules by which we operate say: o J3 votes on the answer at a J3 meeting; a simple majority vote marks the answer as "passed by J3 meeting". o Between J3 meetings the chair of /interp sends a J3 letter ballot to J3 to approve interp answers that have been "passed by J3 meeting". The letter ballot runs for 30 days. Not voting on three of four consecutive J3 letter ballots is grounds to terminate J3 membership. An interp answer passes by a 2/3rds vote; a no vote must be accompanied by an explanation of the changes necessary to change the member's vote to yes. J3/interp reserves the right to recall an interp answer for more study even if the answer passes. 3 Fortran interpretations are currently "Passed by J3 meeting" after J3 meeting #190. This is the letter ballot phase to go from "Passed by J3 meeting" to "Passed by J3 letter ballot". The following Fortran interpretations are being balloted: Yes No Number Title --- --- F03/0139 Functions returning procedure pointers --- --- F03/0140 Type of nested construct entities --- --- F03/0141 More than one specific interface for a procedure The text of these interpretations is attached. Each interpretation starts with a row of "-"s. Please mark the above -Y- in the Yes column for "yes", -C- in the Yes column for "yes with comment", or -N- in the No column for a "no" answer {be sure to include your reasons with "no"} and send only the above text {not this entire mail message} with any comments to j3@j3-fortran.org by 11:59:59PM, PDT, Friday, 18-Dec-2009, in order to be counted. Thanks /Stan ---------------------------------------------------------------------- NUMBER: F03/0139 TITLE: Functions returning procedure pointers KEYWORDS: procedure pointer DEFECT TYPE: Erratum STATUS: Passed by J3 meeting QUESTION: (1) Is a function permitted to return a procedure pointer? Much of the language talks about the function result variable, but a procedure pointer is not a variable. For example, 2.2.3 says [12:16] "The VARIABLE that returns the value of a function is called the RESULT VARIABLE." (emphasis mine); which indicates that the value of a function is returned in a variable. (2) Where may a function reference that returns a procedure pointer appear? In particular, (a) as a in a SELECT TYPE or an ASSOCIATE statement; (b) within parentheses as a primary; (c) as the argument to an intrinsic inquiry function such as KIND or LEN. (3) [12:18-19] says "a subroutine may be used to change the program state by changing the values of any of the data objects accessible to the subroutine". A procedure pointer is not a data object, so is this meant to imply that a subroutine is not permitted to change the state of a procedure pointer? Similar text for functions appears in the same paragraph. ANSWER: (1b) Yes, a function is permitted to return a procedure pointer; the text calling this a variable is in error. Edits are supplied to correct these mistakes. (2b) It was intended that a function reference that returns a procedure pointer only be permitted as an argument to the ASSOCIATED and NULL intrinsic functions and in places where an ordinary procedure name would be acceptable. Parentheses around a pointer act to dereference the pointer and return a copy of the value: this action is inapplicable to procedures. Thus the answers to the specific sub-questions are No, No, and No again. Clarifying edits are provided. (3) No, this implication should not be drawn. A clarifying edit is provided. EDITS for (1b): [12:17] Change "The variable that ... the result variable" to "The entity that ... the function result". [75:13] After "function result" delete "variable". [93:16] After "of the result" delete "variable". [115:7] After "function result" delete "variable". [280:18-19] After "name of the result" delete "variable". [280:22] After "name of the result" delete "variable". [280:31] After "name of the result" delete "variable". [280:33] After "not specified, the" Change "result variable" to "name of the result". [280:34] After "references to the result" delete "variable". [280:34-35] Delete "The characteristics ... the result variable.". [280:36] After "that of its result" change "variable" to "entity". {Ugh.} [280:36] Change "is a pointer" to "is a data pointer", [280:37] After "shape of the result" delete "variable". [280:38] Change "result variable" to "function result". [280:39] After "with the result" delete "variable". [280:40+2] In the first sentence of Note 12.37, Change "variable" to "entity" twice. [283:20] After "name of its result" delete "variable". [283:22] Change "result variable" to "result name". [283:25] Change "result variables identify the same variable" to "result names identify the same variable" and delete ", although their names need not be the same". {Arguably should be done anyway.} [287:17] After "The result" delete "variable". [400:7] "result variable is a scalar"->"result is a scalar object". [407:8] After "identify the result" delete "variable". [407:12-13] After "identify the result" delete "variable". [407:22-23] Change "variable" to "entity" thrice. {Ugh.} [415:40] Change "result variables" to "function results that are variables". [417:18] Change "of the result" to "of the result entities if they are variables". [423:14] "The result variable of a function" ->"The result of a function that returns a data object". [430:13] "data object"->"data entity". [434:10] Delete whole line. EDITS for (2b). [117:27+] Insert new constraint "C703 (R701) The shall not be a function reference that returns a procedure pointer." [160:17+] Insert new constraint "C809a (R819) shall not be a function reference that returns a procedure pointer." [292:8+] Insert new paragraph "An argument to an intrinsic procedure other than ASSOCIATED, NULL, and PRESENT shall be a data object." EDITS for (3). [12:19] After "data objects" insert "or procedure pointers". {Clarify answer to question 3.} SUBMITTED BY: Malcolm Cohen HISTORY: 09-295 m190 F03/0139 submitted - Passed by J3 meeting: B answers passed ---------------------------------------------------------------------- NUMBER: F03/0140 TITLE: Type of nested construct entities. KEYWORDS: ASSOCIATE, DATA, FORALL, SELECT TYPE DEFECT TYPE: Erratum STATUS: Passed by J3 meeting QUESTION: Consider the example: PROGRAM bad REAL x INTEGER i,y(10) ASSOCIATE (x=>i) ! B DATA (y(x),x=1,10)/10*1/ ! A DO x=1,10 ! B y(x) = SQRT(y(x)) ! B END DO ! B FORALL(x=1:10) y(x) = y(x)**2 ! C END ASSOCIATE ! B x = SUM(y) END PROGRAM Is this program conforming? That is: Within the ASSOCIATE construct, is X of type INTEGER? It certainly is in the statements marked with "! B". But according to 16.3 paragraph 2 [409:18-20], in the statement marked "! A", X has the type it has in the scoping unit, which would have to be REAL. And according to 16.3 paragraph 3 [409:25-27], in the statement marked "! C", X has the type it has in the scoping unit, which would have to be REAL. If X is type REAL for DATA and FORALL, the program would not be conforming, but it would be if X were of type INTEGER. ANSWER: Within the scope of a construct entity name, it was intended that a data-implied-do index or a FORALL index name should have the type and type parameters of the construct entity name. Edits are provided to clarify this. EDITS: [409:19] 16.3 Statement and construct entities, para 2, sentence 2, Before "scoping unit" insert "innermost executable construct or". {Makes a difference for DATA in ASSOCIATE and SELECT TYPE only.} [409:26] 16.3, paragraph 3, sentence 2, Before "scoping unit" insert "innermost executable construct or". {Makes a difference for FORALL in ASSOCIATE and SELECT TYPE only.} SUBMITTED BY: Malcolm Cohen HISTORY: 09-301 m190 F03/0140 submitted - Passed by J3 meeting ---------------------------------------------------------------------- NUMBER: F03/0141 TITLE: More than one specific interface for a procedure KEYWORDS: Specific interface DEFECT TYPE: Erratum STATUS: Passed by J3 meeting QUESTION: Consider the example: module A contains subroutine S ( X ) real :: X end subroutine S end module A module B use A, only: T => S end module B module C use A, only: U => S end module C program P use B ! Access the procedure name T use C ! Access the procedure name U ! T and U are different names for the same procedure. end program P Is this program conforming? The procedure S defined in the module A has two explicit specific interfaces in program P. The sixth paragraph after constraint C1211 in subclause 12.3.2.1 says "A procedure shall not have more than one explicit specific interface in a given scoping unit." ANSWER: It was intended that this program be conforming. An edit is provided to correct this. EDITS: [260:1 last sentence of sixth paragraph after constraint C1211 in subclause 12.3.2.1] Insert "name" after "procedure". SUBMITTED BY: Van Snyder HISTORY: 09-304 m190 F03/0141 submitted - Passed by J3 meeting ----------------------------------------------------------------------