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 #26885 is a reply to message #26884] Wed, 03 October 2001 09:03 Go to previous messageGo to previous message
Todd Clements is currently offline  Todd Clements
Messages: 23
Registered: January 2001
Junior Member
> Does anybody know of making IDL performing an explicit variable check
> during compilation ?

I don't think there is a way to do this since, as David said, IDL is a
weakly typed language.

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 since cases like the third
one might give unexpected results that you don't detect later. It's much
better to embrace the weakly typed variables and reuse the same variable
several times in each function. That way, your job prospects are much
more secure since you're the only one who can figure out how your code
works (my background and training in C programming is coming out now, I
think...)

Todd
[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:39:20 PDT 2025

Total time taken to generate the page: 0.00413 seconds