title: Can Fortran PURE functions use global parameters?
body: <p>It seems to me the what is called a pure function in Fortran is not considered pure enough for those who use functional programming. So here is my question. Suppose I have the following code:</p>
  
  <pre><code>MODULE basics
    IMPLICIT NONE
    INTEGER, PARAMETER      :: dp = kind(1.0d0)
    REAL(dp), PARAMETER     :: PI=3.1415926535897932_dp
    REAL(dp), PARAMETER     :: earthEquatorialRadius=6378.137_dp
  END MODULE basics
  
  MODULE myFunctions
    USE basics
    IMPLICIT NONE
  
    PURE REAL(dp) FUNCTION sphericalArc(angleInRadians) 
      REAL(dp),INTENT(IN)  :: angleInRadians 
  
      sphericalArc= 2.0*PI*earthEquatorialRadius*angleInRadians
    END FUNCTION sphericalArc
  END MODULE myFunctions
  </code></pre>
  
  <p>The function sphericalArc has no side effects, so it's pure in that sense, but it uses global constants. It's true that the parameters PI and earthEquatorialRadius can be defined inside the function but this is undesirable since I would like to use these in other functions and subroutines. It's going to be even more tedious to make the dp type defined in each function or procedure.</p>
  
  <p>So from Fortran's perspective is a function that uses global parameters defined outside of the function still considered pure and can be called from a do concurrent loop? </p>