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

Home » Public Forums » archive » About keywords and positional parameters
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: About keywords and positional parameters [message #32811 is a reply to message #32720] Thu, 07 November 2002 13:15 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
JD Smith (jdsmith@as.arizona.edu) writes:

> I agree that you can't tell if a parameter is *meant to be* an input
> parameter, an output parameter, or both without reading the documentation,
> but you certainly can tell whether it is *capable* of passing output:
>
> if arg_present(parameter) then parameter=myungodlyfunction(foo)
>
> ARG_PRESENT() may or many not reveal anything useful, depending on the
> context. Its primary legitimate use is in avoiding calculations of
> optional keyword/argument outputs if the caller didn't ask for them.

I have a feeling this piece of helpful advice is more
likely to confuse Mr. Zhang than enlighten him, but please
don't get me started on the havoc caused by mis-named
functions. Remember, if you want to know if a keyword
is *used* or not in your program, you have to follow
JD's helpful advice:

pro testme, KEY=k
if n_elements(k) ne 0 OR arg_present(k) then $
print,'You used KEY!' else $
print,'You neglected KEY!'
end

You can find all the nitty-gritty details here:

http://www.dfanning.com/tips/keyword_check.html

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Previous Topic: Re: Fit a circle ?
Next Topic: slicer3

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

Current Time: Wed Oct 08 19:55:47 PDT 2025

Total time taken to generate the page: 0.00486 seconds