(j3.2006) another example of a forward reference
Robert Corbett
robert.corbett
Fri Mar 13 03:04:51 EDT 2015
On 03/12/15 16:52, Malcolm Cohen wrote:
> <<<
> Ian Harvey posted an article on comp.lang.fortran
> in which he asserts that the Fortran standards
> allow an array constructor to include a<type-spec>
> that is the name of a derived type that is defined
> after the occurrence of the array constructor.
>>>>
>
> An interesting conceit, that published standards never have errrors or
> omissions.
I was not sufficiently clear. Ian Harvey said that the standards
allow such array constructors. He did not say that they should
allow such array constructors. His posting includes an example
that creates a circular definition using such an array constructor.
Ian Harvey knows that published standards have errrrors and
omisions.
I think Ian Harvey did get something wrong in a later posting in
that thread. He asserted that a <type-spec> cannot specify a
length type parameter in a constant expression. I think he based
his assertion on Clause 4.2, paragraph 5 [50:6-7] of the
Fortran 2008 standard, which states
A length type parameter may be used in specification
expressions within the derived-type definition for the
type, but it shall not be used in constant expressions.
That statement can be read in more than one way.
I would like the array constructor shown in Note 4.74 of
the Fortran 2008 standard (Clause 4.8, paragraph 8+, [86])
to be a standard-conforming constant expression.
Bob Corbett
More information about the J3
mailing list