Re: Yet again, The Sky is Falling! [message #52970 is a reply to message #52872] |
Fri, 09 March 2007 10:27   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
> mgalloy@gmail.com writes:
>
>> Moral of the story: don't change the value of input parameters.
>
> Except, of course, when that is the POINT of the input parameter.
But, then it's not an input parameter. It's an output.
I'm f95-centric, and I know it doesn't apply completely to IDL for a number of reasons,
but I don't think people should new code where the functionality depends on *how* the
arguments are passed (i.e. by value or reference).
It's a shame IDL doesn't allow for something similar to the fortran95 intent attribute for
arguments, e.g.
function myfunc(x,y,z) result(a)
real, intent(in) :: x, y, z
real :: a
...
x = 1.0 ! Illegal. Compiler will not allow mods to intent IN argument
...
end function myfunc
cheers,
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
|
|
|