Version 1.2 of ai05s/ai05-0076-1.txt
!standard 3.9.2(2/2) 08-02-25 AI05-0076-1/02
!class binding interpretation 07-12-05
!status ARG Approved 8-0-0 08-02-09
!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 {(a function with a controlling result)}, then the call
has a controlling result - the context of the call can
control the dispatching. Similarly, if the call is to a
function with {an} access result type designating T
{(a function with a controlling access result)}, then the
call has a controlling access result, and the context can
similarly control dispatching."
!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)
Replace the paragraph:
A call on a dispatching operation is a call whose name or prefix
denotes the declaration of a dispatching operation. A controlling operand
in a call on a dispatching operation of a tagged type T is one whose
corresponding formal parameter is of type T or is of an anonymous access type
with designated type T; the corresponding formal parameter is called a
controlling formal parameter. 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 T, then the call has a
controlling result — the context of the call can control the dispatching.
Similarly, if the call is to a function with access result type designating T,
then the call has a controlling access result, and the context can similarly
control dispatching.
by:
A call on a dispatching operation is a call whose name or prefix
denotes the declaration of a dispatching operation. A controlling operand
in a call on a dispatching operation of a tagged type T is one whose
corresponding formal parameter is of type T or is of an anonymous access type
with designated type T; the corresponding formal parameter is called a
controlling formal parameter. 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 T (a function with a controlling result),
then the call has a controlling result — the context of the call can
control the dispatching. Similarly, if the call is to a function with an
access result type designating T (a function with a controlling access
result), then the call has a controlling access result, and the context
can similarly control dispatching.
!ACATS Test
An ACATS test is not needed, as there is no 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.)
****************************************************************
Questions? Ask the ACAA Technical Agent