(j3.2006) Change in F2008 regarding elemental procedures
Malcolm Cohen
malcolm
Tue Aug 23 20:03:13 EDT 2011
>I don't recall this happening but I just noticed a change between F2003 and
>F2008 regarding the execution order of an >elemental procedure applied to an
>array.
In F2008 there are impure elemental procedures...
>F2003:
>
>"as would have been obtained if the scalar function had been applied
>separately, in any order, ..."
>
>F2008:
>
>"as would have been obtained if the scalar function had been applied
>separately, in array element order, ..."
There is no difference for a pure procedure.
>My question is whether this is intended and if so, why.
Yes, it matters for impure procedures. We specify the order to give an
unambiguous interpretation, since impure procedures may have side-effects.
> For DO CONCURRENT we specify that "executions may occur in any order"
> (8.1.6.6.2). So this change surprises me because I can't think of a reason
> why order should be specified for calling a pure elemental procedure.
The order does not matter for a pure elemental procedure at all, since it is not
permitted to have side-effects.
>Although I guess I can see how order would be important if an array is updated
>in place, but shifted:
>
> real :: A(100)
> A(1:10) = elemental_function(A(2:11))
Huh? The semantics of intrinsic assignment are that the <expr> is evaluated,
than the value assigned to the variable. There is no overlap between the
assignment and the evaluation.
The same thing happens in WHERE and FORALL.
We really did get these things right 20 years ago you know.
>So perhaps I've answered my own question.
Well no.
Cheers,
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list