global problems
Richard Gaskin
ambassador at fourthworld.com
Tue Aug 2 16:00:40 EDT 2005
Mark Wieder wrote:
> Jacque-
>
> Tuesday, August 2, 2005, 8:07:41 AM, you wrote:
>
>
>>Globals are necessary when one has a suite of stacks that must interact
>>as a unit. One very common example is a "find" handler. Assume a number
>>of data stacks, each a clone of the others. A handler asks what you want
>>to find and puts that string into a global. The next time the user wants
>>to find something, you can use the same string to allow a persistent
>>search across many stacks.
>
>
> Yes, I do understand what globals are and why one may want to use
> them. I do actually use them, albeit sparingly. My conceptual problem
> here is with the persistence of global variables in the IDE once the
> stack or suite of stacks that used them has been purged from memory.
>
> In your example, can you think of a reason for the "find" string to
> persist after you have closed the suite of stacks that initialized and
> used the find handler and you've gone on to work on another project?
I doubt this behavior is going to change. Apple established how globals
work in HyperTalk in 1987, and all xTalks have implemented them the same
since.
If this is causing a problem in your projects you might consider putting
initialization code into your stack's preOpenStack handler to set
globals to any values required by the current project.
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list