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

Re: Passing optional parameters through a wrapper routine

Kenneth P. Bowman <bowman@null.tamu.edu> wrote in message
> In article <MPG.130a910d141f1260989a21@news.frii.com>, davidf@dfanning.com
> (David Fanning) wrote:
> > Having said that, it absolutely behooves you to check
> > each and every variable you plan to use in your program
> > to make sure you have a defined variable at the time
> > you use it. This is normally done with the N_Elements
> > function, since this function returns a 0 if its argument
> > is undefined.

Responding to the excerpt from David's message (which I haven't seen in full

I don't see anything generally wrong with passing variables on without
knowing what they are or whether they are defined. That's what a wrapper
routine does -- it concerns itself with some subset of the information
passed to it and let's the "wrappee" deal with the rest. RSI in their wisdom
invented inheritance mechanisms to do this with keywords. For a general
wrapper routine with an unknown number of positional parameters I favour the
"case n_params()" syntax originally proposed by Kenneth. If I get a chance
tomorrow I may illustrate this using my (almost completely) general wrapper
routines that report on the execution time of the wrappee.

Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand