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

Re: Functions and arrays



On 4 Dec 1996, Stein Vidar Hagfors Haugan wrote:
> People at RSI (and not just support people) do read this newsgroup (and 
> act on it as well: XPAD/YPAD/SPACE=0 will once again rule, in IDL v 5.0!), 
> so this place may very well be the best place for a campaign to remove 
> this quite serious (and dangerous) "feature". I do think that we need to 
> show some enthusiasm  to make it happen, though (i.e., the more people 
> agreeing about this being a rather nasty thing that they'd like to see 
> removed, the better).

I'd also really like to see this ambiguity sorted out.


> Or at least get a compile time error about the possible mixup,
> something like "Error: test1 interpreted as a function in line 5,
> but as a variable in line 10".

I think that this would be a good idea.   It wouldn't bust any code that
wasn't already hovering on the edges of "busthood", and it would catch many
of the ambiguities.   When requested to compile a function, IDL could stop with
an error if a variable of the same name already existed.   When requested to
create a new variable, IDL could stop with an error if a function of the same
name had already been compiled, or had been declared in a FORWARD_FUNCTION
statement.
This would still have some holes.   Functions are often coded in their own
source files (one function per file) to facilitate automatic compilation.
One would have to force the compilation of such functions with RESOLVE (or
such), or flag them with FORWARD_FUNCTION, to be sure of things.

But I think that a proper cure would involve a basic syntax change, like
using [] instead of () on arrays.   If RSI proposed this, I think I would
actually consider supporting it.   (I'm sure I'm pretty much alone in this
opinion - just thought I'd mention it.)


Peter Mason