[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some special behaviour of ROUTINE_NAMES



Craig Markwardt wrote:
> I don't know what possibilities you are talking about :-), but you can
> make funny and illegal structures by yourself too.  Amuse your
> friends.
> 
> IDL Version 5.2.1 (linux x86). (c) 1999, Research Systems, Inc.
> IDL> foo = create_struct('1',1, '2',2)
> IDL> help, /struct, foo
> ** Structure <817fda4>, 2 tags, length=4, refs=1:
>    1               INT              1
>    2               INT              2
> IDL> print, foo.(0), foo.(1)
>        1       2
> 
> But, as you can see, the elements can be accessed by using the
> array-like indexing of structure tags.

Don't make a habit of it, because it's illegal in IDL 5.3:

IDL Version 5.3 (Win32 x86). (c) 1999, Research Systems, Inc.
IDL> foo = create_struct('1',1, '2',2)
% CREATE_STRUCT: Illegal tag name: 1.
% Execution halted at:  $MAIN$                 

The documentation actually states that structure tag names must follow
the same rules as variable names. It just wasn't enforced in
create_struct() prior to IDL 5.3.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley