global problems
Mark Wieder
mwieder at ahsoftware.net
Tue Aug 2 02:37:43 EDT 2005
Brian-
Monday, August 1, 2005, 6:56:19 PM, you wrote:
> For me, the rationale is simple: globals are the ONLY way to have data
> which is _not_ stack specific. As such, closing or modifying a stack
> should never delete global data.
I still don't get this. Can you give me an example of something you'd
declare as a global and *want* it to stick around when the stack that
declared it is closed?
> Perhaps what you're really looking for is a stack-level local variable?
no... I declare globals sometimes thinking I'll need them for
cross-stack variables, then usually rethink things and can do without
them. But then they're still in memory causing trouble.
> I'm thinking the seeming oddity of the situation has something to do
> with the loose restrictions on declarations in xTalk, and the runtime
> nature. In other languages, if you removed all references to a global
> and recompiled, of course it would disappear...?
...which is what I expected to happen here... my bad.
Here's a problem scenario as a gedanken-experiment:
Open stack A
stack A has the global gXYZ
*and* puts a value into gXYZ
finish working with stack A, close and remove from memory
Open stack B
stack B also declared global gXYZ
now stack B is open and has a value in gXYZ
but never initializes it
exit the IDE
Relaunch the IDE
Open stack B
now stack B has no value in gXYZ
and some functions fail that rely on gXYZ
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list