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

Re: check for duplicate routine names?




Michael W Asten <masten@mail.earth.monash.edu.au> writes:

> 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.


Yes, I think IDL would be improved by more quality-of-code features
that could detect problems like this.

Another thing that would be nice is warnings about ambiguous uses of
variables that might shadow a function in the library.  Note this
code:

   max = max(x, min=min)

The next time you use min(x), will you get the function or the
variable named min?

You might say, "oh, I used square brackets, this is not a problem,"
but since round parenthesis are still allowed (unless you disable
them), I believe this can still be a problem.  This has bitten me a
*few* times, so I'm not saying it's a huge deal.  It is a compile time
issue since peoples' function libraries are different.

Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------