Adding UNION/MAP -- Feedback and tips pls!
W Spector
w6ws@earthlink.net
Sat Mar 2 00:18:00 GMT 2013
Janne Blomqvist wrote:
> IIRC F90+ decided to use "%" for the component selector syntax instead
> of "." used by the STRUCTURE/RECORD/UNION/MAP extension and many other
> languages, because it turned out that "." was ambiguous in Fortran
> syntax. Thus, in order to not risk mis-parsing perfectly standard
> conforming code, this extension should probably only be enabled via a
> separate option rather than being part of any of the -std= feature
> sets (the cray pointers implementation might provide a suitable
> example of how this can be done).
If I may insert my $0.02 as a lowly user of gfortran:
DEC created the "VAX Structures" extension way back before Fortran-90,
when there was still hot debate about what derived types would look
like. They intentionally chose a syntax that was incompatible with what
the Standards committee was doing. Presumably this was in the hopes
that there wouldn't be a conflict later on, when the committee had
actually produced the new standard, and users would eventually convert
over. Or alternatively there would be so many using the DEC extension
that other vendors would be compelled to implement the feature
regardless of what the Standards committee did. In practice there was
some of both. It caused enormous compatibility problems.
The "." to separate component names does conflict with Fortran-90s
user-defined operator syntax. Code should use "%" to be as unambiguous
and as Standard-conforming as possible. So I would also add my vote
that, if it 'dot compatibility' implemented, it only be enabled via a
compatibility option.
Should UNION/MAP itself also be enabled by a compatibility option?
(Separate from a 'dot compatibility' option - if implemented?)
Walter
More information about the Fortran
mailing list