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

Re: Accessing "main" level variables



Craig Markwardt wrote:
> 
> [...]
> 
> I like your questino.  I know I will get flamed for saying it, but I
> think there are some times when it is desireable for a program to
> deposit its results into the main level.  For example, a fully canned
> curve fitting program may want to return the fitting results.  This
> should of course be done with full control and permission of the user.
> 
> "Why," you ask, "don't you just return it as a regular or keyword
> parameter?"
> 
> "Simple," I say.  "You don't always know how many variables you are
> going to return."  Also, if it were a curve fitting program "for
> dummies" then I would want to make it as simple as possible.
> 
> Incidentally, there is an internal IDL routine which *can* do this.
> Unfortunately you need to write a DLM to access it.
> 
> Craig
> 
> --
> --------------------------------------------------------------------------
> Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> --------------------------------------------------------------------------

No! No flaming. But as you describe it, the solution to your problem
would
sound like almost the typical object oriented approach. Simple enough,
too,
once the user understands he/she has to write 
   obj_fit->get_parameter,a0=a0,m=m    
(or something similar)
The nice thing would be that you decouple the actual fitting process
from the 
output, so you can access the fit result at any time (until you
obj_destroy
the fit object, of course). You could still write a
procedural/functional
interface for the object to prevent the "uninitiated" user from running
away.

Cheers,
Martin

PS: maybe I shut put a foot in my mouth, for I am talking so much about
objects these days but never supply any useful routines which make use
of them ;-( One day that will change for sure!...

-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[