Re: .compile_opt strictarr is persistent? [message #50558] |
Tue, 10 October 2006 13:38 |
badjelly.witch
Messages: 27 Registered: May 2006
|
Junior Member |
|
|
Craig Markwardt wrote:
>
> To me, it's kind of dangerous that one module can so drastically
> change the behavior of the system at a global level.
Module? Better clear that concept from the IDL compartment in your
brain.
You haven't been programming in Python, have you?
|
|
|
Re: .compile_opt strictarr is persistent? [message #50566 is a reply to message #50558] |
Tue, 10 October 2006 00:22  |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
David Fanning wrote:
> mgalloy@gmail.com writes:
>
> Indeed, I stumbled onto this in an IDL programming class
> I was teaching. But COMPILE_OPT STRICTARR in an IDL startup
> file does wonders for re-programming the finger/brain
> connections. :-)
>
> Cheers,
>
> David
>
> P.S. Of course, the same thing is true of COMPILE_OPT DEFINT32.
> VERY nice!
I have
compile_opt defint32, strictarr, strictarrsubs, obsolete
!WARN.OBS_ROUTINES
in my idl startup file. Works really well in cleaning up code. Now, if
only there was a command-line switch to make all float constants typed
at teh command line default to double, I'd be really happy.
Maarten
|
|
|
|
|
Re: .compile_opt strictarr is persistent? [message #50581 is a reply to message #50569] |
Mon, 09 October 2006 12:46  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
Kenneth Bowman wrote:
> In article <1160418720.740991.36680@m7g2000cwm.googlegroups.com>,
> "mgalloy@gmail.com" <mgalloy@gmail.com> wrote:
>
>> Follow David's advice as above. I did try this because it seemed odd
>> behavior you were describing. IDL does not complain if you have a
>> compile_opt statement outside of any routine in a file. It will change
>> the behavior of the main-level (but not the routines in the file). I
>> think I will make a list sometime of the most dangerous things IDL will
>> let you do.
>>
>> Mike
>> --
>> www.michaelgalloy.com
>
> I have
>
> COMPILE_OPT IDL2
>
> in my startup.pro.
>
> I thought this was a feature. :-)
>
> (At least the short/long integer part of IDL2).
>
> Ken
I agree -- I have it in my startup file, too. But that's a batch file
that I know gets called on startup. Something like this just sitting
between routines in a file would be a tough thing to find.
Mike
--
www.michaelgalloy.com
|
|
|
Re: .compile_opt strictarr is persistent? [message #50583 is a reply to message #50581] |
Mon, 09 October 2006 12:32  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
David Fanning <davidf@dfanning.com> writes:
> Craig Markwardt writes:
>
>> Should I put the .compile_opt statement *within* each individual
>> function in the module?
>
> Absolutely. I'm not sure where you are using the
> compile_opt statement (no period in front of it,
> by the way), but if you use it at the IDL main
> level, it is defined at the main level. If you
> want it in effect inside procedures and functions,
> it will have to be declared inside each and every
> procedure or function you want to use it in.
OK, thanks! I made the changes in my local copy and it seems to work
fine.
I'm sort of afraid to convert all of my stuff wholesale to array[]
notation... it's hard to test everything.
Thanks to all the replies!
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: .compile_opt strictarr is persistent? [message #50584 is a reply to message #50583] |
Mon, 09 October 2006 11:46  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1160418720.740991.36680@m7g2000cwm.googlegroups.com>,
"mgalloy@gmail.com" <mgalloy@gmail.com> wrote:
> Follow David's advice as above. I did try this because it seemed odd
> behavior you were describing. IDL does not complain if you have a
> compile_opt statement outside of any routine in a file. It will change
> the behavior of the main-level (but not the routines in the file). I
> think I will make a list sometime of the most dangerous things IDL will
> let you do.
>
> Mike
> --
> www.michaelgalloy.com
I have
COMPILE_OPT IDL2
in my startup.pro.
I thought this was a feature. :-)
(At least the short/long integer part of IDL2).
Ken
|
|
|
Re: .compile_opt strictarr is persistent? [message #50586 is a reply to message #50584] |
Mon, 09 October 2006 11:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mgalloy@gmail.com writes:
> Follow David's advice as above. I did try this because it seemed odd
> behavior you were describing. IDL does not complain if you have a
> compile_opt statement outside of any routine in a file. It will change
> the behavior of the main-level (but not the routines in the file). I
> think I will make a list sometime of the most dangerous things IDL will
> let you do.
Indeed, I stumbled onto this in an IDL programming class
I was teaching. But COMPILE_OPT STRICTARR in an IDL startup
file does wonders for re-programming the finger/brain
connections. :-)
Cheers,
David
P.S. Of course, the same thing is true of COMPILE_OPT DEFINT32.
VERY nice!
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: .compile_opt strictarr is persistent? [message #50587 is a reply to message #50586] |
Mon, 09 October 2006 11:32  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
David Fanning wrote:
> Craig Markwardt writes:
>
>> Should I put the .compile_opt statement *within* each individual
>> function in the module?
>
> Absolutely. I'm not sure where you are using the
> compile_opt statement (no period in front of it,
> by the way), but if you use it at the IDL main
> level, it is defined at the main level. If you
> want it in effect inside procedures and functions,
> it will have to be declared inside each and every
> procedure or function you want to use it in.
>
> Done this way to ensure backward compatibility, not
> to make your life easier. :-)
Follow David's advice as above. I did try this because it seemed odd
behavior you were describing. IDL does not complain if you have a
compile_opt statement outside of any routine in a file. It will change
the behavior of the main-level (but not the routines in the file). I
think I will make a list sometime of the most dangerous things IDL will
let you do.
Mike
--
www.michaelgalloy.com
|
|
|
Re: .compile_opt strictarr is persistent? [message #50589 is a reply to message #50587] |
Mon, 09 October 2006 11:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Craig Markwardt writes:
> Should I put the .compile_opt statement *within* each individual
> function in the module?
Absolutely. I'm not sure where you are using the
compile_opt statement (no period in front of it,
by the way), but if you use it at the IDL main
level, it is defined at the main level. If you
want it in effect inside procedures and functions,
it will have to be declared inside each and every
procedure or function you want to use it in.
Done this way to ensure backward compatibility, not
to make your life easier. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|