Re: library help -- multiple procedures in one file [message #30957 is a reply to message #30955] |
Fri, 24 May 2002 09:37   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris O'Dell (odell@cmb.physics.wisc.edu) writes:
> This question is mostly aimed at people who build libraries for public
> use (David, Craig, etc). I am putting together a lot of the little
> useful routines I have written as a grad student into a library, and was
> wondering, should I juse make EVERY procedure/function have its own
> file? In PASCAL, I was a big proponent of nested functions;
> functions/procedures really ONLY used by one other procedure or
> function. But in IDL, those functions aren't compiled on the fly and
> you have to open the darn function file and compile them all every time
> you start idlde. Is there any way around this?
There should never be any reason to manually compile
a file in IDL. And it is OK to have many procedures and
functions that are used only once. Just put them in a
file _in front of_ the module that has the same name
as the file. The procedures and functions will be
utility routines for the "command" module. (The command
module is always the LAST module in the file and
has the same name as the file itself.)
If you think in terms of "commands" that you are building.
Then you will have as many files in your library as you
have commands that you want people to know about and use.
Sometimes utility routines become more useful than you
thought they would become, and they want to be used by
some "other" command. Then, you take that utility module
out of the file it is in, put it in a file of its own,
give it the "command" name, and you now have another
command that everyone can use.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|