Re: gotcha: indexing into a scalor [message #7882] |
Sat, 18 January 1997 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Paul Ricchiazzi writes about IDL's ability to subscript scalar values:
> Is this feature carried over to latter versions of IDL?
Not only is it carried over to later versions of IDL, but I
am sure the really expert IDL programmers like Ray Sterner
and others will tell you that it has become an indespensible
component of their own programming styles. :-)
Just to give you one example, some people use it to prevent
scalar variables from being passed by reference in IDL programming
calls. (Subscripted variables are passed by value, not by
reference.) Consider this program:
PRO DOUBLE, number
number = number * 2
END
Compare the results if I do this:
IDL> a = 5
IDL> DOUBLE, a
IDL> Print, a
10
As opposed to this:
IDL> a = 5
IDL> DOUBLE, a(0)
IDL> Print, a
5
Interest has sort of fallen off for the IDL Expert Programmers
Convention (too many people holding their breath for IDL 5.0, I
hear), but this is the sort of thing that *might* have gotten you
invited. ;-)
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
|
|
|