[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Global variables and IDL
David Foster wrote:
> <Deleted >
>
> I applaud your courage Martin! My name is David Foster, and I have
> been a common-block user...
>
> I think the idea of global variables would be very powerful, and the
> ability to have global pointers would be extremely useful in our
> applications. We have a series of programs that are run consecutively,
> on the same LARGE data-sets, and we use common blocks to store these
> data sets. We find this approach much faster than other possibly
> "cleaner" programming approaches, and for our purposes we would never
> want to have more than one instance of one of these programs running.
> If we did, we could certainly structure the common variables to
> accomodate this!
>
> If global variables were to be introduced into IDL, I would hope
> that we would also get some mechanism for limiting the visibility
> of these variables, some way to say "use this global variable" within
> a routine. Something similar to the EXTERN construct in C.
>
> Coming from a C background, my first impression of IDL was that it
> provides *very* limited control over scope and visibility of variables
> and function/procedure names.
>
> Dave
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> David S. Foster Univ. of California, San Diego
> Programmer/Analyst Brain Image Analysis Laboratory
> foster@bial1.ucsd.edu Department of Psychiatry
> (619) 622-5892 8950 Via La Jolla Drive, Suite 2240
> La Jolla, CA 92037
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As a long time IDL programmer I also admit to using common blocks for global variables.
Common blocks for widget programs are generally a bad idea, but, for variables with
truly
universal scope in an application, common blocks allow the variable the necessary scope
while hiding them from the user.
RSI developed pointer variables as a replacement for handles but they suffer from the
problem
that a user can be completely overwhelmed if he types: help, /heap and an application
has used
several hundred pointers.
My background is Fortran not C, but I totally agree with Dave that the ablility to
limit the scope
and visibility of a variable should not be overlooked in the quest for global
variables.
Paul
==============================================================================
L. Paul Mix
Distinguished Member of the Technical Staff
Electromagnetics and Plasma Physics Analysis
Sandia National Laboratories
MS 1186, P.O. Box 5800
Albuquerque, NM 87185-1186
E-mail: lpmix@sandia.gov
Phone: (505) 845-7493
FAX: (505) 845-7890