global variable change in substack not available to main stack
Mark Wieder
mwieder at ahsoftware.net
Sun Jul 10 12:30:48 EDT 2011
Slava-
Sunday, July 10, 2011, 7:46:21 AM, you wrote:
> handler was forwarding the openCard message which in turn reinitialized the
> globals, and thus the new value got lost. My only excuse is that it was 3 AM
> on a Sunday.
And this is exactly why I think the use of global variables is a Bad
Idea. Global variables can be set from anywhere, and trying to track
down what happened and why your code isn't working the way you expect
it to is a real pain. I think I can count the number of times I've had
to resort to global variables on the fingers of one hand. I don't
think 3AM Sunday is the issue - it's not particularly anything you did
wrong, it's just that the nature of global variables encourages these
problem scenarios.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list