undeclared variables getting through in Strict Compilation mode

Bob Sneidar bobsneidar at iotecdigital.com
Tue Feb 17 00:55:17 CET 2015


The simple way to avoid that in the future is what many have suggested for the eons we have been posting on this list: Name your variables in such a way that they *cannot* conflict. For instance, globals should start with a g as in gFormApp. Local variables might start with an l (some say p but others say that should be for passed parameters). It’s really up to you. the important thing is that simply by looking at a variable, you can know it’s “scope” (pseudo scope I suppose since LC does not really scope variables). 

Bob S


> On Feb 16, 2015, at 13:19 , Dr. Hawkins <dochawk at gmail.com> wrote:
> 
> On Mon, Feb 16, 2015 at 11:07 AM, J. Landman Gay <jacque at hyperactivesw.com>
> wrote:
> 
>> Is the global declared at the top of the script? Are you trying to use a
>> local variable in a handler with the same name as the global?
>> 
>> 
> no & nope.
> 
> There is a single local variable declared outside of any scripts (to flag
> initialization when returning to the mainstack).  No globals declared
> outside of handlers.
> 
> These are declared global inside handlers, so declaring them local should
> cause an error with strict compilation.
> 
> When I step through, the array gets elements, and they disappear when
> returning to the calling program.
> 
> -- 
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> 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