finding shadowed globals when strict compilation is on
Dr. Hawkins
dochawk at gmail.com
Sat Apr 20 21:28:39 EDT 2013
On Sat, Apr 20, 2013 at 6:06 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:
> Saturday, April 20, 2013, 4:40:56 PM, you wrote:
>
>> Is there *any* way to find out the offending other variable when
>> "local name shadows" ??
>
> That's what strict compilation is supposed to do :-P
Well, yeah, when the other one *exists*.
> A variable, once
> it's used, *is* available in the "local" scope. It's always in memory
> until it's deleted. So locally you could pop up the message box, type
> "global yournamehere;delete yournamehere" and then compile your
> script. But that would only be a temporary fix because you'd still
> have a var name conflict.
even so, it would be nice to have a hint on the rare occasion that
it's correct . . .
> What are you trying to accomplish? Use the variable name as a local
> var and *not* as a global one?
Nope; just fighting a bug in strict compilation, it seems. But
sometimes it's possible that the same name was indeed used in one of
hundreds of scripts . . .
> It's a good idea to usse a naming convention and start your global var
> names with a "g" prefix and *never* start local var names with "g"
> (use a different prefix for local vars). Then you won't run into this
> kind of conflict.
I'm slowly getting there--but there's zillions of variables in use
from before I was doing that . . .
> But anyway, in the script editor type control-F, then click the More
> button that appears at the bottom. Change the scope to Stack Files and
> you'll get a list of everwhere that var name is used.
Does this work for anyone? Peter's suggestion of the "other" find is
what worked for me.
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
More information about the use-livecode
mailing list