[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL 5.3 serious problem: save files sneakily restored

Vinay L. Kashyap (kashyap@head-cfa.harvard.edu) writes:

> IDL 5.3 appears to have a major hull breach.
> If there is an idl save file named "<whatever>.sav" in the current
> directory,
> the contents of that file get restored whenever <whatever> is referenced as
> a function within IDL.
> Comments?

Uh, I'm not sure it's a hull breach. If I understand
you correctly this has been a behavior of IDL for a
long, long time.

If you have a piece of code like this:

   IDL> a = junker()

IDL assumes that JUNKER is a function. Many people 
think IDL goes looking in the !Path for a file junker.pro,
but in fact it looks for a file junker.sav *first*. This 
is so that if you have compiled the file junker.pro and 
saved it:

   IDL> .Compile junker.pro
   IDL> Save, junker, /Routines, File='junker.sav'

the compiled version will be found and used. You don't
have to always be compiling everything and slowing yourself
down. A *very* nice feature of IDL that I like a lot.

You are just running into a situation in which you
have a variable and a function with the same name.
It's not an unknown problem in IDL, but a relatively
rare one, given the huge number of functions and variables
people create. IDL does an excellent job of keeping track

I think the solution is to just be a little more
careful with naming conventions. Perhaps a dollar
sign ($) in the name if the file contains saved
variables and not saved routines.



P.S. Let's just say having to be careful is a whole
lot better than having to be rigorous and compile
everything every time we need it. :-)
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155