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

Home » Public Forums » archive » Re: wrapper functions
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: wrapper functions [message #50498 is a reply to message #50497] Thu, 05 October 2006 18:28 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Robbie writes:

> I disagree, procedures should not use N_ELEMENTS() to check for
> UNDEFINED positional parameters.

Say what!? I would argue that procedures should ALWAYS
use N_ELEMENTS to check for undefined parameters. You
should use N_ELEMENTS *everywhere*!

> It should be presumed that the
> positional parameters are defined according to the documentation,
> anything else should throw an error.

Even I'm not that anal, Robbie. Do you really do this?
Seriously? It's a LOT of work for almost no payoff. Do
you check data type, too?

> If you want to write a procedure which has more relaxed conditions then
> I would recommend using keywords.
>
> Don't most IDL procedures use N_PARAMS() to check for positional
> parameters?
> This means that there is a difference between calling
> READ_PICT, Filename, Image, R, G, B
> and
> READ_PICT, Filename, Image
> regardless of whether R,G,B are defined or not

I'm not a big fan of optional positional parameters, either.
My rule of thumb is that required parameters are positional
parameters and optional parameters are keyword parameters,
unless you have a VERY good reason for doing something else.
And then, of course, if you write a lot of objects you soon
learn that life can be made a LOT easier if you just do away
with positional parameters entirely.

But I never go ANYWHERE without my good ol' N_ELEMENTS by
my side! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: executing a string in VM without using 'EXECUTE'
Next Topic: reading .mat files in IDL

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

Current Time: Wed Oct 08 19:30:41 PDT 2025

Total time taken to generate the page: 0.00426 seconds