(j3.2006) (SC22WG5.5376) [ukfortran] Question on PURE subroutines

Malcolm Cohen malcolm
Fri Dec 5 02:13:18 EST 2014

Damian Rouson writes:
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.

Yes, I've seen this several times before (basically ever since PURE showed up). 
There are a lot of times that PURE as currently defined is sufficient for 
parallelism, but equally there are times when they are insufficient - even for 
pure functions.  An attribute like WHITER_THAN_THE_DRIVEN_SNOW would not only 
improve performance in such cases, they would also give the user a stronger 
guarantee that he was not inadvertantly shooting himself in the foot.

So far though I've not seen any reasonable spelling for such an attribute 
(FUNCTIONAL is the best I've noticed so far, and is pretty bad).  And so far 
I've not seen much enthusiasm for Yet Another Attribute with arguably marginal 
benefits (in my estimation, PURE gets most of the benefits both from the point 
of view of performance and safety).

................................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list