What does 'shadows' mean?
alex at tweedly.net
Mon Oct 10 09:34:10 EDT 2011
Hmmm - a bit of a long shot, but worth trying.
I recently discovered that even when 'explicit variables' is turned on,
you don't always need to declare a variable !! I thought this was a
bug, and reported it, but the official reply was that this is intended
behaviour. Seems wrong to me, but apparently that's the way it is.
If a variable is used as a repeat loop control variable (e.g. repeat for
each key K in ...., etc.) then it is *implicitly* declared for you, and
won't cause an error even if explicit variables is on. And then, if you
subsequently do declare a variable with that name, then you get the
"shadows another variable" error.
For example, (the entire script)
> on abc
> repeat with t1 = 1 to 10
> -- do nothing
> end repeat
> local t1
> put "asd" into t1
> end abc
t1 is implicitly declared in line 2, and then line 5 produces an error.
Turning off explicit variables fixes the error.
I'm not quite sure if that could cause your problem, but it's another
thing to check for.
On 10/10/2011 11:56, Alex Tweedly wrote:
> You're right - it does (normally) mean that the variable you are
> trying to declare shares a name with a previously declared variable.
> No idea why you're getting it in this case.
> Poor ideas :
> - If you like, send me the script and I'll look to see if it fails here
> - try it in an earlier (or later) version of LC
> - change every occurrence to 't2' and see what happens.
> -- Alex.
More information about the Use-livecode