@mecej4 you can follow the thread I linked: What is a pure function?, in particular, go here: Pure function - Wikipedia. The “pure” attribute in Fortran means no side-effects (roughly speaking no writing to global variables), but you can still read from global variables, which is what the function f()
does. The reason it surprises you is because you probably expect “pure” to mean both side-effect-free and deterministic (no reading from global variables). That’s why I did the survey, and as of now, 74% of people who voted also expect that (myself included). The meaning of “pure” is subjective, so it’s better to just talk about the two properties (side-effect-free and deterministic) and just keep in mind that the Fortran “pure” keyword just means side-effect-free, but does not enforce deterministic.
2 Likes