!standard 3.9.2(2/2) 07-12-05 AI05-0076-1/01 !class binding interpretation 07-12-05 !status work item 07-12-05 !status received 07-10-25 !priority Low !difficulty Easy !qualifier Omission !subject Meaning of "function with a controlling result" !summary Define the meaning of "function with a controlling result". !question 3.9.3 (in a number of places) takes about a "function with a controlling result". If we look up the definition of "controlling result", we find 3.9.2(2/2) which says "If the call is to a (primitive) function with result type T, then the call has a controlling result — the context of the call can control the dispatching." This clearly defines a *call* with a controlling result, but nothing is said about a *function* with a controlling result. This is in contrast to "controlling formal parameter", which is defined for formal parameters. So what exactly is a "function with a controlling result"? !recommendation (See Summary.) !wording Modify the last two sentences of 3.9.2(2/2): If the call is to a (primitive) function with result type T, then the call has a *controlling result* — the context of the call can control the dispatching. {A *function with a controlling result* is one that can be used in such a call.} Similarly, if the call is to a function with {an} access result type designating T, then the call has a *controlling access result*, and the context can similarly control dispatching. {Again, a function that can be used in such a call is known as a *function with a controlling access result*.} AARM Ramification: A function with a controlling result or controlling access result is necessarily a primitive function of some tagged type, but not all primitive functions have controlling results as that depends on the result type of the function. !discussion We could also have eliminated the term from 3.9.3. That initially appears easy, as we're mainly talking about primitive functions. But we would have to talk about the result type (or result access type) of the function, and since the 3.9.3 word just says "a type", we'd have to liberally sprinkle "T" (as in "a type T") all over to make the wording correct. This won't help the understandability of the text. It seems reasonable to define such a term; we do define "controlling formal parameter" and it seems weird to not do something similar for function results. We don't need to specify for which type the function has a controlling result, as it can be primitive only for a single tagged type (by 3.9.2(12)). That simplifies the already complex wording of 3.9.3. !corrigendum 3.9.2(2/2) @drepl A @i is a call whose @fa or @fa denotes the declaration of a dispatching operation. A @i in a call on a dispatching operation of a tagged type @i is one whose corresponding formal parameter is of type @i or is of an anonymous access type with designated type @i; the corresponding formal parameter is called a @i. If the controlling formal parameter is an access parameter, the controlling operand is the object designated by the actual parameter, rather than the actual parameter itself. If the call is to a (primitive) function with result type @i, then the call has a @i @emdash the context of the call can control the dispatching. Similarly, if the call is to a function with access result type designating @i, then the call has a controlling access result, and the context can similarly control dispatching. @dby A @i is a call whose @fa or @fa denotes the declaration of a dispatching operation. A @i in a call on a dispatching operation of a tagged type @i is one whose corresponding formal parameter is of type @i or is of an anonymous access type with designated type @i; the corresponding formal parameter is called a @i. If the controlling formal parameter is an access parameter, the controlling operand is the object designated by the actual parameter, rather than the actual parameter itself. If the call is to a (primitive) function with result type @i, then the call has a @i @emdash the context of the call can control the dispatching. A @i is one that can be used in such a call. Similarly, if the call is to a function with an access result type designating @i, then the call has a controlling access result, and the context can similarly control dispatching. Again, a function that can be used in such a call is known as a @i. !ACATS Test An ACATS test is not needed, as there intended rule change. !appendix From: Randy Brukardt Sent: Thursday, October 25, 2007 9:13 PM My previous question reminded me that there appears to be a terminology problem in the Standard. It's just hair-splitting in the sense that the meaning is obvious, but... 3.9.3 (in a number of places) takes about a "function with a controlling result". If we look up the definition of "controlling result", we find 3.9.2(2/2) which says "If the call is to a (primitive) function with result type T, then the call has a controlling result — the context of the call can control the dispatching." This clearly defines a *call* with a controlling result, but nothing is said about a *function* with a controlling result. This is in contrast to "controlling formal parameter", which is defined for formal parameters. I don't see "function with a controlling result" used in the rest of the standard, so it probably is just a mistake in 3.9.3. OTOH, it is so logical, that perhaps the best fix is to define it properly in 3.9.2. Any thoughts on which is better? In any case, this is a low priority AI at best. **************************************************************** From: Tucker Taft Sent: Thursday, October 25, 2007 10:18 PM It seems easy enough to define the term, and it seems useful. **************************************************************** From: Robert I. Eachus Sent: Saturday, October 27, 2007 10:27 PM >I don't see "function with a controlling result" used in the rest of the >standard, so it probably is just a mistake in 3.9.3. OTOH, it is so logical, >that perhaps the best fix is to define it properly in 3.9.2. > >Any thoughts on which is better? I'd like to see the fix in 3.9.3. Why? Because either every function has a controlling result The term is meaningful only as a contraction of "a function call wiith a controlling result". Each declared function, inherited function, function created by a generic instance, etc., has a result of a specific type. In other words, procedures and functions are not polymorphic, the polymorphism results from dispatching. Yes, this is very low priority. Having said that though, someone with the wrong idea of what is occuring can read "function with a controlling result" as confirming their incorrect impression. **************************************************************** From: Pascal Leroy Sent: Monday, November 5, 2007 3:17 PM > I don't see "function with a controlling result" used in the rest of the > standard, so it probably is just a mistake in 3.9.3. OTOH, it is so logical, > that perhaps the best fix is to define it properly in 3.9.2. > > Any thoughts on which is better? Define the term in 3.9.2, it makes results more similar to parameters, which is good. (For parameters we talk about the actual and about the formal, it makes sense that for functions we would talk about the call and about the result type.) ****************************************************************