(j3.2006) (SC22WG5.5177) [ukfortran] Draft result of ballot on Corrigendum 3
Bill Long
longb
Wed Dec 25 12:26:16 EST 2013
On 12/25/13 2:19 AM, Malcolm Cohen wrote:
> I certainly have no objection to rethinking the way that we describe an
> array-spec with a view to improving the exposition, quite the opposite. But
> that would be for the next revision. And it is certainly unclear at this point
> whether any real improvement could be made, or whether that would just be moving
> the complications out of the BNF and into the prose (as mentioned above, that is
> often a bad idea).
OK, I now see you were focused on BNF ambiguity while I was focused on
visual ambiguity. Hopefully I now get the concept behind the change:
OLD (two syntax terms):
<assumed-size-spec> is used to declare an assumed-size array.
<implied-shape-spec-list> is used to declare an implied-shape array.
NEW (Three syntax terms):
<assumed-size-spec> is used to declare an assumed-size array of rank 2
or larger.
<implied-shape-spec> is used to declare an implied-shape array of rank 2
or larger.
<implied-shape-or-assumed-size-spec> is used for the rank 1 case of
either assumed size or implied shape.
It is unfortunate that <assumed-size-spec> is no longer the syntax for
declaring any assumed-size array, but I guess that is a price we pay for
choosing this answer to the interp.
This is an improvement for BNF readers, but does not really do much for
the programmer. I think it would be helpful (at least in F2015, if not
in the interp) to add a Note at the end of 5.3.8.6, at [96:31+]
something like:
"NOTE 5.12a
For arrays of rank 1, a declaration like
DIMENSION :: X(*)
or
INTEGER :: X(*)
declares either a dummy array or a named constant array, depending on
whether X appears as a dummy argument in a prior FUNCTION, SUBROUTINE,
or ENTRY statement in the program unit, or X appears a named constant in
a subsequent PARAMETER statement in the program unit. The
disambiguating FUNCTION, SUBROUTINE, ENTRY, or PARAMETER statement could
be many lines separated from the declaration statements above. As a
result, such declaration statements could be visually confusing. This
confusion can be avoided if implied-shape arrays are always declared in
a type declaration statement that contains the PARAMETER attribute, such as
INTEGER,PARAMETER :: X(*) = [1,2,3]
"
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list