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

Home » Public Forums » archive » call_method
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: call_method [message #26563 is a reply to message #26480] Fri, 07 September 2001 07:26 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Mark Hadfield" <m.hadfield@niwa.cri.nz> writes:
> OK, to get specific, I have a general purpose graphics object called
> MGHgrGraph, based on IDLgrView. MGHgrGraph has a method called NewAtom that
> creates a graphics atom and attaches it to the graphics tree. Creating an
> object graphics plot usually consists of creating an MGHgrGraph then calling
> NewAtom several times. The function form of the NewAtom method returns a
> reference to the atom; the procedure form doesn't. Most of the time I don't
> need the reference, so I call the procedure form; sometimes I do need the
> reference, so I call the function form. (The code is a bit more readable
> when the procedure form is used, I think.)
>
> The function definition contains all the code to implement NewAtom. The
> procedure form is a wrapper that looks like this
... deleted ...
> The RESULT keyword is for when I change my mind & decide I *do* want the
> object reference after all.

Hi Mark--

Generally speaking when I have some value that I optionally want to
return, I use a keyword. You can even test with arg_present(),
whether the keyword parameter was called with a variable [ for example
if it takes a lot of memory. ]

I think it is bad form in IDL to intentionally have a procedure and a
function of the same name which do the same thing. As you say, it is
too easy to mix them up...

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: a newbie question on code efficiency
Next Topic: Re: object graphics to postcript and how to copy an object tree

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

Current Time: Sat Oct 11 22:08:07 PDT 2025

Total time taken to generate the page: 2.40281 seconds