Name shadows another variable

Peter Haworth pete at lcsql.com
Sun Jun 29 21:27:21 CEST 2014


On Fri, Jun 27, 2014 at 7:08 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:

> If you at some time in the past turned on variable preservation and
> had a script variable of the same name you are now using for a handler
> variable, then that variable scope is still stored with the stack.
> Until you can compile the script with no errors, that conflict will
> still remain. In other words, the stack has stored a reference to the
> named variable with a wider scope than you are now giving it, and that
> reference won't be wiped out until a successful script compilation.
>

Hi Mark,
Having read your theory more closely, I had high hopes that we might
finally have a recipe to reproduce this problem so here's my experiment.

Strict Compile Mode = on
Preserve variables = on

Created a test stack
In the stack script, defined a scrip level variable foo
In a handler in the script, defined a handler level variable named foo.
Compiled - got name shadows variable error as expected.
Changed the name of the handler variable to foo2, compiled with no error.
Saved the stack, closed and removed from memory.

Opened the stack again.
Turned Preserve variables off
Deleted the script level variable foo
Changed the name of the handler level variable foo2 back to foo
Compiled - no errors

I had hoped the error would come up again in that last step but it didn't.

It's entirely possible I haven't understood your theory correctly so if
there's some other experiment I should be trying, let me know.  I;d really
like to track down this thing!

Thanks,
Pete

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>


More information about the use-livecode mailing list