John Reid writes:
Thorsten Ohl wrote:
> > It appears that the standard does not specify unambigiously whether
> > FOO_X = BAR (X, FOO)
> > is a ``function reference'' to FOO or not.
[sample elided]
And John Reid replied:
> Seems pretty clear to me. On page 176, lines 19-21, the standard says:
>
> If RESULT is specified, the name of the result variable of the function
> is result-name, its characteristics (12.2.2) are those of the function
> result, and all occurrences of the function name in execution-part
> statements in the scoping unit are recursive function references.
But Steve Lionel notes:
> "Function Reference" is defined in section 12.4.2 of the F90 standard and
> starts out "A function is invoked during expression evaluation...". It is
> clear that the appearance of the function name FOO in the argument list
> is simply an "actual-arg" (R1213) which can be a "procedure-name".
> The reference does not occur unless and until the dummy argument associated
> with the actual argument is referenced as a function reference in an
> expression, which might take place inside BAR.
I'd basically say that these 2 citations of the standard are
inconsistent. Looks to be an error to me. I'd say the error is in
the section that John Reid cited where it says that "all
occurrences... are recursive function references." I think this
sentence was just written forgetting about the case in question here.
The standard is in general quite specific about defining the term
"reference" and in the case of a function, it means to invoke the
function during expression evaluation, as cited by Steve.
The section cited by John is just trying to distinguish between the
function and the result variable. Yes, the FOO above "clearly" is
referring to the function instead of the result variable, which is
the point I believe the standard is trying to make. But this is
referring to it in a way that does not directly constitute a "reference".
The standard does make a distinction in that it specifically defines
what it means to reference something - and this technical meaning is more
restrictive than the English use of the term "reference". Thus you
can have something that refers (in the English sense) to the function
but is not a function "reference" (in the technical sense).
Although I agree that the section that John Reid cited is clear, I
also think it is clearly wrong. It should have been phrased to use
the broader English terminology (or some equivalent phrasing) instead
of the technical term reference.
This is not an official interpretation. It is my opinion only (and
subject to change if someone convinces me otherwise). But it might
be a good subject for an interp/fix.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|