[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: check for duplicate routine names?
If I had a vote, I'd be strongly against such checking.
This means that any time I try to compile a routine which is already
compiled, I'd be stopped by a warning message?! That would be a disaster
for developing the code.
My take on it, avoid routines with generic names. It is tempting to
write a program called "Just_Doit.pro", but it pays to add
"prj1_just_doit.pro", unless you are writing a *library* function that
will be used universally by your other projects. In that case, there
better not be more than one version. I use these prefixes all the time,
and it gives some side benefits, too (less so now with Projects
available) - sorting by name in file manager puts all related files
together, etc.
Cheers,
Pavel
Michael W Asten wrote:
>
> It is a stupid error to have a two routines of the same name
> DoitNow.pro , in two different library files MyLib1.pro and MyLib2.pro
> .
> But your correspondent is sometimes stupid. The consequence of course
> is that the second compilation (of MyLib2.pro ) over-rides the first (of
> MyLib1.pro) , so whatever was intended by maintenance of the code in
> MyLib1.pro does not execute. Or worse, when the two libs are compiled
> in different sequences, results become unpredictable.
>
> IDL does not appear to give any warning of the compilation of a routine
> of same name as one already compiled. Has anyone any ideas on how such
> errors can be trapped ?
>
> I suggest that at least in an IDL Project, the command "Compile all
> routines" should include such checking as a debugging tool. Or am I
> merely shifting blame for my stupidity onto the compiler? (you know how
> it is when you bang your head the second time, on the same kitchen
> cupboard door?).
>
> Regards,
> Michael Asten