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

Home » Public Forums » archive » Re: Return UNDEFINED from a function
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: Return UNDEFINED from a function [message #50699 is a reply to message #50697] Thu, 12 October 2006 10:53 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 12 Oct 2006 01:04:44 -0700, Ed Hyer wrote:

>> [quoted text muted]
>
> I fail to see how this "feature" could be used. If you call a function as
> value = FUNCTION(args)
> and FUNCTION() returns an <UNDEFINED>, this will cause an error.
>
> Of course, I'm not using my imagination enough. If you have a procedure,
> and you're not feeling like using any normal error-handling mechanism, you
> can simply define it as a function and execute it using HELP, and use a
> HELP-parsing routine to determine if it ran correctly or not. Is there an
> obfuscated IDL contest?

I think it's a shame IDL doesn't have undef() for creating a real,
undefined anonymous variable (you can fake it just by mentioning an
undeclared variable). And, analogously, defined() to test if a
variable is defined (which reads better than 'n_elements(var) ne 0').
But in any case, you could always have something like:

if n_elements(function(args,OTHER=other)) ne 0 then do_something_with,other

Not exactly a standard paradigm, but it might come in useful
somewhere. In particular, if FUNCTION passes an argument through, and
that argument is undefined, it would be nice to keep it undefined.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: call_procedure with a dynamically created keywords list?
Next Topic: Re: difference between icontour and contour?

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

Current Time: Sat Oct 11 09:00:54 PDT 2025

Total time taken to generate the page: 0.16201 seconds