(j3.2006) (SC22WG5.3673) [ukfortran] N1755: Request for new features from MPI Forum
Thu Nov 13 02:22:15 EST 2008
J3 readers, please remember to change your reply to WG5 when it's a WG5
message, otherwise it won't get through...
Robert Corbett wrote:
> N.M. Maclaren wrote:
>> Aargh! No! C 'const'! It has NOT been a success - in fact, to describe
>> it as a paving slab on the road to hell would be fair. [ Yes, I am referring
>> to the saying that the road to hell is paved with good intentions. ]
> The best example of that in Fortran 2003 is the PROTECTED attribute.
> A casual reader of the standard is likely to believe that a variable
> with the PROTECTED attribute cannot be modified outside of the module
> in which it is contained. A careful reading and the interps that
> have been issued make it clear that PROTECTED is a promise made by
> the programmer that he doesn't modifiy the variable outside of the
This is not correct; to call it a "promise made by the programmer" is
not even remotely accurate.
PROTECTED is subject to almost precisely the same restrictions in use,
and the same pitfalls in the guarantees, as INTENT(IN) - it's not quite
a guarantee because we actually wanted INTENT(IN) to be easy to use in a
world that includes things like old procedure libraries that lack INTENT
specs. There are some subtle differences because one is a module
variable and the other is a dummy variable, but those aside, almost
exactly the same.
Now it could be argued that we were trying to be "too nice" to the
casual programmer back in Fortran 8X design days, and that is a
reasonable argument: there is a tension between ease of use and
guaranteed safety here. Perhaps we got that wrong (i.e. the guarantees
are too weak). I might (not?) disagree, but it's nearly 20 years too
late for that debate though.
But if one accepts the INTENT(IN) facility with its minor warts, one
cannot then argue against what we did for PROTECTED since that is not in
practice any more open to abuse.
.....................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3