(j3.2006) (SC22WG5.5373) [ukfortran] Question on PURE subroutines
Damian Rouson
sourcery
Fri Dec 5 01:32:28 EST 2014
On Dec 4, 2014, at 5:25 PM, Malcolm Cohen <malcolm at nag-j.co.jp> wrote:
> [of a pure subroutine]
>> Yet it appears to implement a side effect in a PURE procedure. Was this
>> intended?
>
> I should point out that if a pure subroutine cannot have a side effect, it can
> be replaced by a NOP (since it has no return value).
which is exactly why I?m not a huge fan of pure subroutines, especially those that have ?intent(inout)? arguments. At least if all the arguments are either ?intent(in)? or ?intent(out)?, then pure subroutines would seem to be no different from pure functions if one considers all of the subroutine's ?intent(out)? arguments to be one collective result.
On a somewhat related note, Tom Clune suggested a while back that there be a ?virtuous? attribute that would preclude any access to non-local state. From the standpoint of purely functional programming, I think this would remove a wart that exists with PURE procedures at least in terms of how many people would initially interpret the meaning of PURE.
Damian
More information about the J3
mailing list