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

Home » Public Forums » archive » Bug in N_PARAMS?
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: Bug in N_PARAMS? [message #64066 is a reply to message #64011] Fri, 28 November 2008 02:02 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
The usecase for me is to call a helper routine if not enough parameters
were used.

e.g.

if n_params() lt 2 then begin
MESSAGE,call_help(),/cont
return
endif

The user get's shown the CALLING SEQUENCE description

cheers
Reimar




Mark schrieb:
> On Nov 26, 3:29 am, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
>> Ah. That significantly restricts the utility of
>>
>> SWITCH N_PARAMS() OF
>> 0 : ...
>>
>> ENDSWITCH
>>
>> to provide default values for optional parameters.
>
> Indeed. N_ELEMENTS is what you need for that. The only use I have
> found for N_PARAMS is for writing wrapper routines
>
> pro wrapper, P1, P2, P3, P4, _REF_EXTRA=_extra
> ;; Do some other stuff
> case n_params() of
> 0: wrappee, _STRICT_EXTRA=_extra
> 1: wrappee, P1, _STRICT_EXTRA=_extra
> 2: wrappee, P1, P2, _STRICT_EXTRA=_extra
> 3: wrappee, P1, P2, P3, _STRICT_EXTRA=_extra
> 4: wrappee, P1, P2, P3, P4, _STRICT_EXTRA=_extra
> endcase
> end
>
> Ugly, but sometimes necessary.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Bug in N_PARAMS?
Next Topic: Re: streamlines over contour without iVector

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

Current Time: Sat Oct 11 11:27:22 PDT 2025

Total time taken to generate the page: 1.27760 seconds