To: J3 J3/10-135 From: Van Snyder Subject: Interp F03/0139 Date: 2010 February 16 Interp F03/0139 as balloted --------------------------- Interp F03/0139 passed WG5 letter ballot with three comments "In the edit for [407:21-22] change 'which' to 'that'." "The edit at [417:18] should be: Change 'of the result variables' ... "The word 'which' in the edit for [407:21-22] is correct." There is a minor change to item (3) of the answer. The term (not a defined term) "function result" already has a different meaning that the interp didn't take into account. Subgroup considers the interp to have failed. Slightly revised edits are presented for posterity to ponder. ------------------------------------------------------------------------ NUMBER: F03/0139 TITLE: Functions returning procedure pointers KEYWORDS: procedure pointer DEFECT TYPE: Erratum STATUS: Passed by J3 letter ballot 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 is not intended. A clarifying edit is provided. EDITS for (1b): [12:16] 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". [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+] In Note 12.37, Change "variable" to "entity" four times. [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 entity" and delete ", although their names need not be the same". [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:21-22] "result variable" -> "named result entity which is either a variable or a procedure pointer". [407:22-23] Change "variable" to "entity" twice. [415:40] Change "result variables" to "function results that are variables". [417:18] Change "of the result variables" 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"->"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) The 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, or PRESENT shall be a data object." EDITS for (3). [12:19] After "data objects" insert "or procedure pointers". SUBMITTED BY: Malcolm Cohen HISTORY: 09-295 m190 F03/0139 submitted - Passed by J3 meeting: B answers passed 10-105 m191 Passed as amended by J3 letter ballot #20 09-307 ------------------------------------------------------------------------ Edits for 09-007r3 ------------------ [04-007:12:16] Change "The variable that ... the result variable" to "The entity that ... the function result". becomes [09-007r3:10:25+] after 1.3.68 <> "1.3.68.1 <> entity that returns the value of a function" [09-007r3:15:22-24] Delete 1.3.112 <>. [04-007:75:13] After "function result" delete "variable". is not needed (already done at [09-007r3:51:35]) [04-007:93:16] After "of the result" delete "variable". becomes [09-007r3:109:29] After "of the result" delete "variable". [04-007:115:7] After "function result" delete "variable". becomes [09-007r3:130:26] After "function result" delete "variable". [04-007:280:18-19] After "name of the result" delete "variable". becomes [09-007r3:307:20] After "name of the result" delete "variable". [04-007:280:22] After "name of the result" delete "variable". becomes [09-007r3:307:24] After "name of the result" delete "variable". [04-007:280:31] After "name of the result" delete "variable". becomes [09-007r3:307:27] After "name of the result" delete "variable". [04-007:280:33] After "not specified, the" Change "result variable" to "name of the result". becomes [09-007r3:307:29] After "name of the result" delete "variable". [04-007:280:34] After "references to the result" delete "variable". becomes [09-007r3:307:30] After "references to the result" delete "variable". [04-007:280:34-35] Delete "The characteristics ... the result variable.". becomes [09-007r3:307:30-31] Delete "The characteristics ... the result variable.". [04-007:280:36] After "that of its result" change "variable" to "entity". becomes [09-007r3:307:31-32] After "that of its result" change "variable" to "entity". [04-007:280:36] Change "is a pointer" to "is a data pointer", becomes [09-007r3:307:32] Change "is a pointer" to "is a data pointer", [04-007:280:37] After "shape of the result" delete "variable". becomes [09-007r3:307:33] After "shape of the result" delete "variable". [04-007:280:38] Change "result variable" to "function result". becomes [09-007r3:307:33] Change "If the result variable" to "If the function result". [04-007:280:39] After "with the result" delete "variable". becomes [09-007r3:307:35] After "of the result" replace "variable" by "entity". [04-007:280:40+] In Note 12.37, Change "variable" to "entity" four times. becomes [09-007r3:307:35+] In Note 12.43, Change "variable" to "entity" four times. [04-007:283:20] After "name of its result" delete "variable". becomes [09-007r3:310:18] After "name of its result" delete "variable". [04-007:283:22] Change "result variable" to "result name". becomes [09-007r3:310:19] Change "result variable" to "result name". [04-007:283:25] Change "result variables identify the same variable" to "result names identify the same entity" and delete ", although their names need not be the same". becomes [09-007r3:310:21-22] Change "result variables identify the same variable" to "result names identify the same entity" and delete ", although their names need not be the same". [04-007:287:17] After "The result" delete "variable". becomes [09-007r3:314:9] After "The result" delete "variable". [04-007:400:7] "result variable is a scalar"->"result is a scalar object". becomes [09-007r3:435:8] "result variable is a scalar"->"result is a scalar object". [04-007:407:8] After "identify the result" delete "variable". becomes [09-007r3:443:7,10] After "identify the result" delete "variable" twice. [04-007:407:12-13] After "identify the result" delete "variable". becomes [09-007r3:443:10] After "identify the result" delete "variable". [04-007:407:21-22] "result variable" -> "named result entity which is either a variable or a procedure pointer". [09-007r3:443:18] "result variable" -> "named result entity which is either a variable or a procedure pointer". [04-007:407:22-23] Change "variable" to "entity" twice. becomes [09-007r3:443:19-20] Change "variable" to "entity" twice. [04-007:415:40] Change "result variables" to "function results that are variables". [09-007r3:451:8-9] Change "result variables" to "function results that are variables". [04-007:417:18] Change "of the result variables" to "of the result entities if they are variables". [09-007r3:452:26] Change "of the result variables" to "of the result entities if they are variables". [04-007:423:14] "The result variable of a function" ->"The result of a function that returns a data object". becomes [09-007r3:458:17] "The result variable of a function" ->"The result of a function that returns a data object". [04-007:430:13] "data object"->"entity". is not needed in 09-007r3 (this is the glossary). [04-007:434:10] Delete whole line. is not needed in 09-007r3 (this is the glossary). EDITS for (2b). [04-007:117:27+] Insert new constraint "C703 (R701) The shall not be a function reference that returns a procedure pointer." is not needed in 09-007r3 (we allow left-hand functions now). [04-007:160:17+] Insert new constraint "C809a (R819) The shall not be a function reference that returns a procedure pointer." becomes [09-007r3:170:17+] Insert new constraint "C802a (R805) The shall not be a function reference that returns a procedure pointer." [04-007:292:8+] Insert new paragraph "An argument to an intrinsic procedure other than ASSOCIATED, NULL, or PRESENT shall be a data object." becomes [09-007r3:318:7+] Insert new paragraph "An argument to an intrinsic procedure other than ASSOCIATED, NULL, or PRESENT shall be a data object." EDITS for (3). [04-007:12:19] After "data objects" insert "or procedure pointers". becomes [09-007r3:30:31] After "data objects" insert "or procedure pointers".