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

Home » Public Forums » archive » Re: global variables in IDL
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: global variables in IDL [message #28638 is a reply to message #28637] Fri, 28 December 2001 08:22 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Pavel Romashkin wrote:
>
> I agree with Kristine. Working around Commons writing a global variable
> code, if you use Xmanager, is kind of silly becasue Xmanager uses Common
> blocks in the first place.

This objection, though oft-repeated, is somewhat unfounded, I think.
The chief problem with common blocks for global state data is that only
a single such block exists. For example, if you store the widget id of
a button in:

common mywidget, mybutton
mybutton=widget_button(base,value='Foo')

Then `mybutton' will be the *only* button that can exist for your
program in a single IDL session. You won't be able to invoke your
program more than once at a time. Actually, you will, and that single
button variable slot will get overwritten, and very bad things will
happen.

XManager does use common blocks, but, by design, it uses them
intelligently. Instead of overwriting common block variables, it
maintains global lists of all the widgets it needs to manage, extending
and pruning the lists as necessary. It's an example of common block
usage which doesn't prevent multiple copies of a single widget program
from running. (Here I gloss over the subtlety that widget programs run
with /NO_BLOCK are actually handled by the command-line loop code, and
not XManager at all.)

The fact that common blocks, in their basic usage, can cause this subtle
problem doesn't imply that this problem is endemic to their use:
XManager is an example of a more intelligent setup which capitalizes on,
rather than suffers from, the single global instance status of common
block variables.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Gridding Gui
Next Topic: Inverting the image

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

Current Time: Fri Oct 10 10:02:03 PDT 2025

Total time taken to generate the page: 2.15886 seconds