(j3.2006) (SC22WG5.3684) [ukfortran] N1755: Request for new features from MPI Forum

Robert Corbett Robert.Corbett
Fri Nov 14 00:45:48 EST 2008


Malcolm Cohen wrote:
> 
> Robert Corbett continues to complain about PROTECTED.
 >
> Well, excuse me if we thought users would prefer to be able to pass 
> PROTECTED variables to INTENT(IN) dummy arguments.

I don't see how the statement above relates to anything I wrote.

> It's not 
> unreasonable to provide something less safe instead of providing 
> something that's perfectly safe but in practice is nearly useless.
> 
> As I said (and you admitted), the situation is no worse than 
> INTENT(IN).  It's not at all like C const as you must know.

I'm sorry, but I don't know that.  It seems comparable to me.

> It's 20 
> years too late to be quibbling about INTENT(IN), but if you want to 
> argue about that, well in my opinion it wasn't possible to design 
> something that gave perfect safety that couldn't be subverted at the 
> same time as fulfilling the other design goals of INTENT(IN).

I did not bring up INTENT(IN).

> In any case, the user has to deliberately hide stuff from the compiler 
> to get it to do "bad things" to a PROTECTED variable.  It's not like 
> this is hard to detect if he wants to detect it.

I don't understand why you think a user would have to deliberately
hide information from the compiler to create a situation where a
variable with the PROTECTED attribute is defined outside the module
in which it is declared.  All a programmer needs to do is pass the
variable as an actual argument to a procedure outside the module that
either does not have explicit interface at the point of the call or
does not specify an INTENT for the corresponding dummy argument.  If
the procedure directly or indirectly defines the corresponding dummy
argument, the variable will be defined outside the module.

I see no basis to believe that such situations will arise only through
deliberate efforts to "hide stuff from the compiler."  Given the number
of times I have seen programs pass constants as actual arguments to
procedures that define the corresponding dummy arguments, I expect
such situations will occur fairly frequently with no intent to deceive
on the part of the programmers.

Bob Corbett



More information about the J3 mailing list