comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL 8.0 compile_opt changes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL 8.0 compile_opt changes [message #69240 is a reply to message #69187] Mon, 28 December 2009 04:36 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Dec 24, 11:49 am, pp <pp.pente...@gmail.com> wrote:
The trouble happens if there
> are both a function and a variable with the same name. If the
> reference is found before the function is compiled, it is taken to be
> a variable. If the function happens to have been compiled, the
> reference is taken to be a function. So the conversion of a file does
> not depend only on its contents, but also on the environment when the
> file is read. And as many other topics here indicate, routine name
> resolution is fraught with difficulties.

That ambiguity provides a reminder of why users should use square
brackets for indexing, irrespective of any IDL 8.0 changes. The test
program

pro test
rot = indgen(3)
print,rot(1)
return
end

will treat rot(1) as the ITTVIS rot.pro function, rather than a
variable, but only if it has been previously compiled. The
consistent use of square brackets for indexing removes all ambiguity.

While a program to automatically convert to square brackets won't know
whether a user really wants rot(1) to be a function call or an indexed
variable, it can certainly flag all such ambiguous cases, so that the
user can manually edit them if they don't want the function call.
Such cases should be relatively rare, and one could argue that the
program was broken to begin with.


Incidentally, Bill Thompson had written a converter to square brackets
that was better than mine. (It handled most EXECUTE() strings and
main level programs.) It is available at http://tinyurl.com/yasbr7m

--Wayne
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: envi_title_bar.ico missing and null pointer dereferenced error when using .sav file in ENVI
Next Topic: A routine to annotate PS files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 13:25:59 PDT 2025

Total time taken to generate the page: 0.55970 seconds