| Re: Yet again, The Sky is Falling! [message #53031 is a reply to message #52872] |
Tue, 13 March 2007 03:24   |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
JD Smith wrote:
> On Fri, 09 Mar 2007 10:25:41 +0100, Paolo Grigis wrote:
>
>> Here's a simple example of a routine that returns different values if it
>> is called by value or by reference.
>>
>> pro pg,a,b
>>
>> b=arg_present(a)
>>
>> end
>>
>>
>> IDL> x=1
>> IDL> pg,x,b
>> IDL> print,b
>> 1
>>
>> IDL> pg,x+0,b
>> IDL> print,b
>> 0
>>
>> IDL> pg,x[0],b
>> IDL> print,b
>> 0
>
> That's a bit of a contrived example, given that the whole reason I
> originally lobbied for ARG_PRESENT was so you could differentiate between
> by-value and by-reference arguments (which I observed IDL's own internal
> routines could do, so clearly it was functionality waiting to be exposed).
>
> JD
>
Sure, but it may nevertheless come handy for the next
submission to the obfuscated IDL code contest ;-)
Ciao,
Paolo
|
|
|
|