pixelbird at interisland.net
Mon Aug 1 19:47:01 CDT 2005
> Date: Mon, 1 Aug 2005 11:00:47 -0700
> From: Mark Wieder <mwieder at ahsoftware.net>
> Subject: Re: global problems
Just a little note from"the other" Ken (or one of them) --
> Hmmm... "delete global"... you're right - I use globals so
> infrequently that it wouldn't have occurred to me that I would have to
> delete something that didn't exist. That's pretty screwy, IMO. I don't
> think there's anything else in xtalk that acts that way.
There is a reason.
> certainly don't.
Well, why would they? They're opposite things to variables.
> If the compiler enforced reference counting when
> compiling that would take care of this.
Not a good idea _if_ you want to retain the variable across your
projects during runtime.
> Yet another reason to avoid the Dreaded Global.
Globals are for what they say they are. A global declared during
runtime _should_ be available in any open stack. Why would you want to
get rid of it, i.e., that's what they're for. Unless you want to do a
one-time setup to initialize multiple stacks, then destroy it. Of
course you could do the same thing with custom props, but it would be
I think all you have to do is be aware of what they are. The only
'Dreaded' thing I can see is that they are often misused/overused,
i.e., the wrong tool. Like using an adjustable wrench when you _should_
use the correct size box wrench.
IOW, it's a better idea to pass sensitive data in message or function
params, or perhaps custom props, than globals, when possible, then use
them locally at will. Nothing else gets affected.
But if you wanted to set up a _system_ using multiple stacks all
sharing same data, whether open or closed, then a global may well
become your good and faithful friend.
All the best,
More information about the use-livecode