Script local variables

Graham Samuel livfoss at mac.com
Sun Feb 23 05:30:58 EST 2014


I've just read that bit of the dictionary and I'm equally surprised. I also think I  must have completely misunderstood it, because I can't see how it can work. The value of a script local variable (unless it's predefined using an '=' construction) is undefined until a script is run, and is then only defined when an executing script puts something into the variable. A script can only be run when the program is executing. When the program containing the script quits, any information in variables, global or local, is lost because one can't normally save an executable stack outside the IDE (yes, I know about splash stacks and such, but the principle is correct). So next time the script is compiled, we **must** be back at square one, and the value of local variables **cannot** be maintained. What's wrong with this thinking?

Puzzled

Graham

On 23 Feb 2014, at 03:58, J. Landman Gay <jacque at hyperactivesw.com> wrote:

> On 2/22/14, 8:42 PM, Mark Wieder wrote:
>> Scott-
>> 
>> Saturday, February 22, 2014, 6:26:31 PM, you wrote:
>> 
>>> Uh, oh -- I do this all the time.
>> 
>>> Is this really not supposed to work?
>> 
>> It sometimes works, but it's not legal syntax.
>> I don't know of any particular reason why not, but it's not.
>> 
> 
> They must have changed it when you and I weren't looking. Variable assignments are even listed in the examples in the dictionary entry for "local". I may have to read the whole dictionary again to see what else I've missed.
> 
> I may also have found a clue to disappearing locals. The same entry says this: "If variable preservation is turned on, script locals retain their values when the script is re-compiled, unless there is an error in the script."
> 
> I'm quite sure I've produced enough errors to have destroyed a few script locals in my time, so maybe that's what's wrong. I'll try to pay more attention.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list