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

Home » Public Forums » archive » Writing programs to use static methods but still compile in IDL 7
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Writing programs to use static methods but still compile in IDL 7 [message #91803] Sun, 30 August 2015 09:05 Go to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I am trying to update my code to use the static methods introduced in IDL 8.4 when the user has V8.4 or later. So I write a statement like the following

if !VERSION.RELEASE GE '8.4' then return,str.replace(in,out)

This works in IDL 8.0 and later but in IDL 7.1.1 and earlier it gives a compilation syntax error.


compile_opt idl2
if !VERSION.RELEASE GE '8.4' then return,str.replace(in,out)
% Syntax Error. Attempt to subscript array with parenthesis. Please use '[]'.

Is there a way to have a program use the static methods when the user has IDL 8.4 or later without causing a compilation syntax error in IDL 7?

An example program is
http://idlastro.gsfc.nasa.gov/ftp/pro/misc/repstr.pro

Thanks, --Wayne
Re: Writing programs to use static methods but still compile in IDL 7 [message #91804 is a reply to message #91803] Sun, 30 August 2015 10:29 Go to previous messageGo to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Sun, 30 Aug 2015 09:05:40 -0700 (PDT), wlandsman wrote:

> I am trying to update my code to use the static methods introduced in IDL 8.4 when the user has V8.4 or later. So I write a statement like the following
>
> if !VERSION.RELEASE GE '8.4' then return,str.replace(in,out)
>
> This works in IDL 8.0 and later but in IDL 7.1.1 and earlier it gives a compilation syntax error.
>
>
> compile_opt idl2
> if !VERSION.RELEASE GE '8.4' then return,str.replace(in,out)
> % Syntax Error. Attempt to subscript array with parenthesis. Please use '[]'.
>
> Is there a way to have a program use the static methods when the user has IDL 8.4 or later without causing a compilation syntax error in IDL 7?
>
> An example program is
> http://idlastro.gsfc.nasa.gov/ftp/pro/misc/repstr.pro
>
> Thanks, --Wayne

Just an idea: Does
if !VERSION.RELEASE GE '8.4' then $
return,call_method('replace',a,in,out)
work? I don't have version 7 installed on my computer.

Cheers, Heinz
Re: Writing programs to use static methods but still compile in IDL 7 [message #91805 is a reply to message #91804] Sun, 30 August 2015 10:35 Go to previous messageGo to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Sun, 30 Aug 2015 19:29:13 +0200, Heinz Stege wrote:

> Just an idea: Does
> if !VERSION.RELEASE GE '8.4' then $
> return,call_method('replace',a,in,out)
> work? I don't have version 7 installed on my computer.

No, I wanted to write:
if !VERSION.RELEASE GE '8.4' then $
return,call_method('replace',str,in,out)

Heinz
Re: Writing programs to use static methods but still compile in IDL 7 [message #91812 is a reply to message #91805] Mon, 31 August 2015 07:57 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Heinz,

Thanks! This syntax works in IDL 8.4 and later but still compiles in IDL 7.1. --Wayne

On Sunday, August 30, 2015 at 1:34:49 PM UTC-4, Heinz Stege wrote:
>

> No, I wanted to write:
> if !VERSION.RELEASE GE '8.4' then $
> return,call_method('replace',str,in,out)
>
> Heinz
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: covariance matrix
Next Topic: Minor obscure error message

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

Current Time: Wed Oct 08 07:17:03 PDT 2025

Total time taken to generate the page: 0.00424 seconds