Variable attributes and undef vars [message #90235] |
Thu, 12 February 2015 15:01  |
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  |
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
|
|
|