[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing zero as a Parameter/ NOT KEYWORD_SET
- Subject: Re: Passing zero as a Parameter/ NOT KEYWORD_SET
- From: davidf(at)dfanning.com (David Fanning)
- Date: Tue, 29 Jun 1999 09:10:30 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <377773B4.8DEAE40@garnet.acns.fsuMMER.edu> <email@example.com> <37777E20.353D94CA@garnet.acns.fsuMMER.edu> <firstname.lastname@example.org> <3778D9D8.75C8E770@astrosun.tn.cornell.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:15442
J.D. Smith (email@example.com) writes:
> That's a bit dangerous. IDL may have strange semantics and constructs,
> but that's no reason not to learn them. I recommend peeking at a bit of
> IDL source code available all over the web. You'll find common
> constructs such as:
> ; give foo a default value if it is undefined.
> if n_elements(foo) eq 0 then foo=5
> ; perform some action if flag is defined and non-zero
> if keyword_set(flag) then compute_something
> ; return something to the caller if var is available to them (by
> if arg_present(var) then var=compute_something_else()
Ah, finally, some sense on this topic! Thanks, JD.
I lost my news feed yesterday and the article I posted on this
topic got eaten by DejaNews (probably fortunately). But nothing
causes more confusion for users than these three totally misnamed
functions: N_Elements, Keyword_Set, and Arg_Present.
I'm in the process of writing an article on the subject for my
web page right this minute. (Why I haven't done it before is
a mystery. It's the single most misunderstood programming
feature I see in my travels.) It will be on my site sometime
this afternoon (Colorado time).
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: firstname.lastname@example.org
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155