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

Re: Accessing "main" level variables

Martin Schultz <martin.schultz@REMOVE.dkrz.de> writes:

> 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.
> > ... portion deleted ...
> 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)
> ... portion deleted ...

I agree with you from a *programmer's* point of view.  A programmer
wants a clean programming interface with predictable behavior.
Clearly a procedure that modifies external variables goes against this

HOWEVER, from a lowly *user's* perspective, I assert that sometimes it
would be nice for a program to manipulate some main level variables
for me.  I know, because I'm both a programmer and a user.  Querying
objects as you suggest, while linguistically pure, will get stale
pretty quickly while I am working interactively at the command line.

In the back of my mind I would like to write a nice graphical curve
fitting application using MPFIT, and I want it to be simple simple
simple.  The question is, how do I get the results out once the fit is


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response