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

Home » Public Forums » archive » Re: Declaration of variables in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Declaration of variables in IDL [message #26884 is a reply to message #26881] Wed, 03 October 2001 09:08 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Todd Clements (mole6e23@hotmail.com) writes:

> However, you can get *some* type of variable checking during run time by
> using structures.
>
> a = {b: fltarr(10), c: 0L}
>
> a.b = 5 ;; this works, setting all elements of b to 5
> a.b = 'hi' ;; this DOESN'T work, yielding a type conversion error
> a.b = findgen(7) ;; this does work, yielding 0,1,2,3,4,5,6,0,0,0
> a.c = [2,3] ;; this DOESN'T work since C is a scalar
>
> Even though you can get some rudimentary type checking this way, I think
> it can cause more problems than it is worth...

With the exception of strings, I don't think I
would call this "type" checking at all. More
like "space" checking, since IDL doesn't care
what you stuff into a structure field as long
as it fits into the memory set aside for it.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Is there a line widget
Next Topic: global singleton object ?

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

Current Time: Wed Oct 08 18:38:54 PDT 2025

Total time taken to generate the page: 0.00416 seconds