Re: arrays vs. functions conflicts [message #38382 is a reply to message #38380] |
Fri, 05 March 2004 07:26   |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
David Fanning wrote:
> Paolo Grigis writes:
>
>
>> Allright, I know this is difficult for IDL, but I would
>> just like to know if there is a way out of the problem...
>> Ok, maybe I was just being too optimistic, and there is
>> not a solution beside hoping that everybody will switch to
>> the []-bracket notation as soon as possible. In the
>> meantime I suppose I have to be careful on the order
>> of compilation of the routines.
>>
>> In any case, there aren't any compiler directives in the
>> main procedure.
>
>
> Well, somewhere then. IDL just doesn't figure this out
> on its own. Are you sure the problem has to do with
> square brackets and not naming conventions? Is the offending
> program in its own file, with the file having the same
> name as the program module?
>
> Cheers,
>
> David
Dear David,
I made a simple example which shows the problem:
--------------------------------
;file test1.pro
FUNCTION test1
return,-1
END
--------------------------------
;file test2.pro
PRO test2
test1=[5,4,6]
print,test1(0:1)
END
---------------------------------
After strting idl:
;this fails
print,test1()
test2
;output:
IDL> print,test1()
% Compiled module: TEST1.
-1
IDL> test2
print,test1(0:1)
^
% Syntax error.
At: /users/pgrigis/test2.pro, Line 5
% Compiled module: TEST2.
% Attempt to call undefined procedure/function: 'TEST2'.
% Execution halted at: $MAIN$
compare with:
;this works
test2
print,test1()
test2
;output
IDL> test2
% Compiled module: TEST2.
5 4
IDL> print,test1()
% Compiled module: TEST1.
-1
IDL> test2
5 4
Quite bad, isn't it?
Cheers,
Paolo
--
____________________________________________________________ ________
Paolo Grigis
ETHZ - Institute of Astronomy email: pgrigis@astro.phys.ethz.ch
Scheuchzerstrasse 7
ETH Zentrum phone: ++41 1 632 42 20
8092 Zurich fax : ++41 1 632 12 05
Switzerland http://www.astro.phys.ethz.ch/
____________________________________________________________ ________
|
|
|