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

Home » Public Forums » archive » Variable attributes and undef vars
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
Variable attributes and undef vars [message #90235] Thu, 12 February 2015 15:01 Go to next message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
From the IDL docs: "All IDL variables have special attributes that return information about the variable. These attributes are equivalent to calling the N_ELEMENTS, SIZE, or TYPENAME functions."

This does not work for undefined variables:

IDL> help, n_elements(a)
<Expression> LONG = 0
IDL> help, a.length
% Expression must be a structure in this context: A.
% Execution halted at: $MAIN$
IDL>

Bug or feature? :-)

regards,
Lajos
Re: Variable attributes and undef vars [message #90236 is a reply to message #90235] Thu, 12 February 2015 15:17 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Thursday, February 12, 2015 at 4:01:51 PM UTC-7, fawltyl...@gmail.com wrote:
> From the IDL docs: "All IDL variables have special attributes that return information about the variable. These attributes are equivalent to calling the N_ELEMENTS, SIZE, or TYPENAME functions."
>
> This does not work for undefined variables:
>
> IDL> help, n_elements(a)
> <Expression> LONG = 0
> IDL> help, a.length
> % Expression must be a structure in this context: A.
> % Execution halted at: $MAIN$
> IDL>
>
> Bug or feature? :-)
>
> regards,
> Lajos

Bug. I think I got worried that it would conflict with "static methods" and "static properties" on IDL classes, so by default it just throws an error. But it probably should just work. Especially because it also doesn't work on !null variables either:

IDL> a = []
IDL> a.length
% Expression must be a structure in this context: A.

I'll think about the right approach...

-Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Linux-like touch command in IDL
Next Topic: IDL array subscripting issue

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

Current Time: Wed Oct 08 09:19:24 PDT 2025

Total time taken to generate the page: 0.00434 seconds