Re: Compile or not compile? [message #42870] |
Thu, 03 March 2005 09:25  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Mon, 28 Feb 2005 16:38:44 +0000, Nuno Oliveira wrote:
> There's something that sometimes in while it bores me a little bit. How do
> I know if I need to compile a function/procedure or it will be able to
> compile "on fly".
>
> At the beginning I thought this was related to the paths idl "knew", but
> this happens for two functions/routines in the same directory.
>
> Can someone tell when a function can be runned without be compile?
If it's on the path, has a file name which corresponds to the routine
name, and is locatable by IDL, it does not need to be explicitly
compiled. Explicit compiling *is* required for:
1. Files which are not in the IDL path (to see what your path is
currently, try print,transpose(strsplit(!PATH,':',/EXTRACT)) must
be compiled explicitly. I think the current directory when you
start IDL is on the PATH as well.
2. Files which have been added to IDL's path after it started. IDL
scans its path at startup, and only files which exist at that time
can be found automatically.
3. For functions or procedures which do not correspond to the
filename, you must explicitly compile the files if you don't first
invoke the function or procedure. This is not a good idea. You
should really stick to names like function_name.pro and
procedure_name.pro to avoid this situation, and put auxiliary
helper routines in those files before the eponymous function or
procedure.
4. Files which have been modified since IDL first compiled them must
be re-compiled (only once: I've seen more than one person who
compiles their routines twice "for good measure").
5. Files which have the same name as other files on the IDL path, but
which show up later on the path (lower in the list reported in #1)
must be explicitly compiled by full pathname. This is also not a
good idea, if it can be avoided. See
http://www.dfanning.com/tips/namefiles.html.
JD
|
|
|