[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

undefined keyword variables




Hi,

A question: should you always be able to pass undefined variables as
keywords to IDL routines?

For example, PLOT is smart enough not to do anything with this undefined
variable

IDL> plot,x,y,title=donkeykong
[plots fine]

but not this one
IDL> plot,x,y,clip=pong
% PLOT: Variable is undefined: PONG.
% Execution halted at:  $MAIN$                 
[no plot produced]

IDL> help,donkeykong, pong
DONKEYKONG      UNDEFINED = <Undefined>
PONG            UNDEFINED = <Undefined>

Should this be considered a bug in plot, or as normal behavior?

In general I don't know why you should be able to safely feed
undefined variables to routines and expect them to work.  But if you
can't, it leads to annoying problems in writing interfaces to any
routine with lots of keywords.  In my case, I wanted to write a
routine that called plot and then oplot, which use different sets of
optional keyword parameters.  The best solution I know of is to
construct a value for the _extra keyword, but it's a pretty convoluted
solution.

Mark Fardal
UMass