Recognizing Potential Naming Conflicts
IDL favors simple names, and it blurs the user level distinction between system routines and user routines. The reason for this has everything to do with IDL's orientation towards ad hoc analysis. The primary goal is transparency. Names should make sense, be easy to remember, and not require too much typing. Language transparency also results in very human-readable code. In conjunction with the way IDL searches for routines, this may cause either user level or system level conflicts.
User Level Conflicts
In the user level case, an IDL user writes a routine that is not part of the base release of IDL, and places it in a local library. At some later date, a new version of IDL is installed that contains a new IDL library routine with the same name as the user's routine. Depending on the order of the directories in the user's path, one of these two routines is executed. If the user's routine is used, IDL library code that calls the routine will get the wrong version and fail in strange and mysterious ways. If the IDL routine is used, the IDL library will be satisfied, but the user's library will get the wrong version, also with bad results.
System Level Conflicts
The system level case is similar, but harder to work around. In this case, the user creates a local routine, as before. However, the new version of IDL contains a system routine with the same name. In this case, IDL will always choose to use the system routine, and the user routine simply vanishes from view never to be called again. The order of the search path is meaningless in this case because the search path is not even consulted. A system routine always has precedence over a user routine.
Choosing Routine Names to Avoid Conflicts
Naming conflicts can result in costly and time consuming problems; carefully considered names make everything easier. On the surface, naming routines seems like a trivial issue, but names are very important. It is crucial to adopt and consistently adhere to a routine naming strategy to avoid conflict. The core idea of this convention (described in detail in Advice for Library Authors) is to prefix all library routine names with a unique identifier, one indicative of your organization or project. We reserve routine names that are generic, and those with an "IDL" prefix on behalf of the entire IDL community. Prefixing your user library routines significantly reduces the risk of namespace collisions with IDL routines.
As a library author, your decision to follow a routine prefixing strategy benefits the entire IDL community. This convention translates into simplicity and reliability, allowing IDL system routines to always take precedence over user routines. It also raises the visibility of your routines, readily distinguishing them as part of your library.
Note
For instructions on how to prefix an existing user library, see Converting Existing Libraries.
Cross-Platform Naming of IDL .pro Files
When naming IDL .pro files used in cross-platform applications, be aware of the various platforms' file naming conventions and limitations. For example, the ":" character is not allowed in a filename under Microsoft Windows.
Be careful with case when naming files. For example, while Microsoft Windows systems present file names using mixed case, file names are in fact case-insensitive. Under Unix, file names are case sensitive—file.pro is different from File.pro.
When writing cross-platform applications, you should avoid using filenames that are different only in case. The safest course is to use filenames that are all lower case.
Remember, too, that IDL commands are themselves case-insensitive. If entered at the IDL command prompt, the following are equivalent:
Automatic Compilation and Case Sensitivity
On UNIX platforms, where filename case matters, IDL looks for a lower-case filename when you enter the name of a user-written routine at the IDL command prompt. Thus, if you save your program file as myprogram.pro and enter the following at the IDL command prompt:
IDL will compile the file myprogram.pro and attempt to execute a procedure named myprogram.
If you save your program file as MyProgram.pro and enter the following at the IDL command prompt:
IDL will not compile the file MyProgram.pro and will issue an error that looks like:
You can compile and run a program with a mixed- or upper-case file name on a UNIX platform by using IDL's .COMPILE or .RUN executive commands:
or, if MyProgram.pro contains a main-level program:
In general we recommend that you use lower-case file names on platforms where case matters.