08-291r2 To: J3 From: Dan Nagle Subject: Intrinsic inquiry functions in init exprs Date: 2008 November 18 1. Introduction The definition of specification inquiry has changed between F2003 and the F2008 draft. It now includes functions that it ought not to. This revision adds NUM_IMAGES as per Bill and Malcolm. 2. Discussion Informally, inquiry functions were things that are supposed to be "safe". We actually say "whose result depends on the properties of one or more of its arguments instead of their values". Unfortunately, we have gone ahead and classified several argumentless intrinsic functions as "inquiry", which not only fails to satisfy the definition, but allows them to appear in initialization expressions even though their values are not compile-time determinable. The functions in question are: COMMAND_ARGUMENT_COUNT() NUM_IMAGES() THIS_IMAGE() Note that COMMAND_ARGUMENT_COUNT was faulty in F2003 also in that it did not satisfy the definition of an inquiry function. However, it was not permitted in an initialization expression so this was not a critical flaw. Furthermore, the classification of intrinsic procedures omits the case of "pure subroutine". This ought to be repaired. 3. Strategies for repair These functions should be reclassified. The reclassification is as transformational; that still requires (very few) words in the definition of an initialization expression to exclude them. 4. Edits for repair strategy [150:7.1.12p1(6)] Change "other than NULL" to "other than COMMAND_ARGUMENT_COUNT, NULL, NUM_IMAGES, and THIS_IMAGE". {Argumentless transformationals need exclusion from this item.} [313:13.1p1] Replace the whole paragraph with "Intrinsic procedures are divided into six classes: inquiry functions, elemental functions, transformational functions, elemental subroutines, pure subroutines, and (impure) subroutines." {Improve wording as well as listing all the actual classifications we use. The word "impure" is parenthesised to indicate that we don't use the word in the classification, but that it is nonetheless the case.} [316:13.5p2] "a subroutine but not pure" -> "an impure subroutine". {Random wording improvement.} [317:13.5 Table 13.1, COMMAND_ARGUMENT_COUNT entry] "I" -> "T". {Change class.} [321:13.5 Table 13.1, NUM_IMAGES entries] "I" -> "T". {Change class.} [322:13.5 Table 13.1, both THIS_IMAGE entries] "I" -> "T". {Change class.} [337:13.7.37p2] "Inquiry" -> "Transformational". {Change class of COMMAND_ARGUMENT_COUNT.} [375:13.7.125p2] "Inquiry" -> "Transformational". {Change class of NUM_IMAGES.} [391:13.7.164p2] "Inquiry" -> "Transformational". {Change class of THIS_IMAGE.} ===END===