When I first started to learn FORTRAN mumblemumble years ago, one of the things that used to trouble me was how a routine 'knew' whether its arguments were meant to be input or output or both. In one sense, the answer was obvious; it didn't need to because the message was implicit in the medium of the code (modulo subtle gotchas such as passing in constants).
Now the language has the INTENT specifier for arguments to routines, so clearly the answer isn't quite so obvious after all. I've never yet used the specifier, so in that sense a routine still doesn't need to know whether arguments are input or output or both. Until recently, I think I had assumed that use of the specifier would not actually affect computed results, but could help the compiler to make the computation more efficient.
What I am wondering now, having been wrestling with my first attempt to write a function with the RECURSIVE specifier, is whether there are situations where the correct use of INTENT is mandatory if the computation is to give the correct result.
Thoughts, anyone?