Re: keyword_set bug or feature [message #4205] |
Mon, 15 May 1995 00:00  |
chase
Messages: 62 Registered: May 1993
|
Member |
|
|
>>>> > "Rob" == Stephen O'Connell <soc@festival.ed.ac.uk> writes:
Rob> Keyword is more than just 1/0 switches! And if you are using them
Rob> to pass values, you just might mistakenly set one equal to zero.
Rob> Andd although its true that you can use n_elements, you're still
Rob> buggered if you have more than one keyword...so it is a bug
Rob> really, in my opinion. Maybe ver. 4.0 has it sorted - does
Rob> anyone know ?
It is not a bug. KEYWORD_SET works exactly as documented in the "IDL
Reference Guide". Furthermore, the guide states: "This function is
especially useful in user-written procedures and functions that
process keywords that are interpreted as being either true (keyword
present and nonzero) or false (keyword was not used, or was set to
zero)." Thus, its purpose is not for checking if a keyword is used to
pass values. Just because KEYWORD_SET does not do what you wish does
not mean it has a bug. Use
N_ELEMENTS(var) NE 0
to check for defined keywords. You can make your own function
"KEYWORD_DEFINED()" if you think it is more convenient than
"N_ELEMENTS(var) NE 0".
Chris
--
===============================
Bldg 24-E188
The Applied Physics Laboratory
The Johns Hopkins University
Laurel, MD 20723-6099
(301)953-6000 x8529
chris.chase@jhuapl.edu
|
|
|