Re: Another small V8.0 bug [message #71885 is a reply to message #71884] |
Mon, 26 July 2010 11:16   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jul 26, 3:11 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jul 26, 3:04 pm, wlandsman <wlands...@gmail.com> wrote:
>
>> OK, I've partially isolated the problem into a 3 line program.
>> Unfortunately, the first line is a call to a fairly long programhttp://idlastro.gsfc.nasa.gov/ftp/pro/database/dbopen .prosothere is
>> a lot more isolation required (and I am done with this for the
>> day).
>
>> pro test
>> dbopen,'bpm16274'
>> list = [124]
>> if list(0) LE 125 then print,'Good value'
>
> The problem is that this line is comparing a list (an object, created
> on this line, which contains the single value 0) with 125. It is just
> the confusion between using the array called list, and the function
> list().
>
> Maybe I am missing something, but I do not see a bug, I see the old
> function/array problem, which manifested because IDL 8 happened to
> have a new builtin function with the same name as the array that was
> being used.
By the way, this case is fortunate because the operator used is le,
which is not overloaded in that class. The following line can be
misleading, as it would not throw an error:
IDL> print,list(0) eq 0
1
This is using the overloaded eq operator, to compare the list with 0.
Which may not be very noticeable if one is reading () as allowed index
operators. It would be more visible with the equivalent
IDL> print,list('abc') eq 'abc'
1
|
|
|