Re: Can an object's structure be redifined without restarting IDL [message #16134] |
Fri, 02 July 1999 00:00 |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Frank Morgan wrote:
> If you're working interactively at top-level you can delete the structure
> and recreate it from scratch with new fields - like:
>
> x = {a:0, b:2.0}
> delvar, x
> x = {a:0, b:2.0, c:5.2}
>
> This avoids the data structure conflict. You can't use delvar in procedures
> though.
Because X is an anonymous structure,
x = {a:0, b:2.0}
x = {a:0, b:2.0, c:5.2}
will work just as well, and does not require DELVAR. You can redefine an
anonymous structure on the command line, or in a procedure, function, or
script.
Named structures however cannot be redefined; their definition is fixed
until the end of the IDL session. For example, the second statement
below is not allowed:
y = {TEST, a:0, b:2.0}
y = {TEST, a:0, b:2.0, c:5.2}
Cheers,
Liam.
--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: Can an object's structure be redifined without restarting IDL [message #16135 is a reply to message #16134] |
Fri, 02 July 1999 00:00  |
Frank Morgan
Messages: 3 Registered: June 1999
|
Junior Member |
|
|
If you're working interactively at top-level you can delete the structure
and recreate it from scratch with new fields - like:
x = {a:0, b:2.0}
delvar, x
x = {a:0, b:2.0, c:5.2}
This avoids the data structure conflict. You can't use delvar in procedures
though.
gabriel rodriguez ibeas wrote:
> Hi everybody.
>
> The problem I have, specially when working with a new object is tha if I
> have to add a new field to it's structure, or change its name, IDL will
> issue a error having to do with 'conflicting data structures' or
> something.
>
> I think something similar occurs with COMMON blocks.
>
> Is there any way to tell IDL to forget about all user defined objecs or
> common blocks without restarting it?
|
|
|
Re: Can an object's structure be redifined without restarting IDL [message #16145 is a reply to message #16134] |
Fri, 02 July 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
gabriel rodriguez ibeas (gabriel@gbt.tfo.upm.es) writes:
> Is there any way to tell IDL to forget about all user defined objecs or
> common blocks without restarting it?
If IDL could "forget about" common blocks and named
structures, we would *all* be in a world of trouble. :-(
Exiting IDL during development is a price we pay for
having IDL work like we expect it to work once we
get the program running.
Cheers,
David
P.S. Let's just say working with named structures
tends to enforce planned programming procedures. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|