----- Original Message -----
I have the following problems with the FORALL statement:
FORALL allows, optionally, a scalar logical expression as
the last argument, similar to, e.g., SUM. But with SUM
this optional argument has the name MASK; not so with FORALL.
Why? This seems to be inconsistent to me.
===============================================
You have nearly answered the question yourself. The FORALL is a *statement*
that has a syntax, including an optional mask that is an array-valued
expression. It is in the same class as the DO or SELECT CASE statements. On
the other hand, SUM is an intrinsic *function* with actual arguments. The
actual arguments correspond to dummy arguments, two of which are optional,
and that can be accessed, optionally, as keywords, with the names ARRAY,
DIM, and MASK. SUM can be used as a primary in an expression but is a
function reference.
As the mask in the FORALL is not an argument, the optional attribute cannot
apply. You can, of course, define an array with the appropriate properties
and that you name MASK and use that in the FORALL as a mask. But either it's
there or it's not.
For further reading, please consult "Fortran 90/95 Explained", Sections 6.9
and 8.11.3.
Hoping that helps,
Mike Metcalf
|