Strict Compile Mode

Peter Haworth pete at lcsql.com
Mon Oct 8 16:15:22 EDT 2012


I'm switching over to to using strict compile mode in all my stacks, which
I should have done long ago.

I was surprised to find that not all variables have to be defined in this
mode.  It seems that using a variable in a repeat command such as "repeat
with x=1 to 10" does not require x to be defined as a local variable, nor
is an error flagged when x is used later in the handler, either within the
loop or after it.  I can't decide if I like that or not.

I like it because most of the time I don't use x outside of the repeat loop
and it seems overkill to have to define it in those circumstances.  However
if I accidentally type "x" when I really meant to type "y", I wouldn't get
an error but my code probably wouldn't work correctly which is the whole
point of strict compile mode.

It also seems that sometimes LC constants have to be enclosed in quotes.
 For example "Set the backgroundcolor of field "xyz" to empty" works fine
but "set the backgroundcolor of field "xyz" to black" fails and I have to
put quotes around black, even though black is colored in the script as if
it is a known LC constant.  Not a big deal, just wondering why that is.

Also, not really related to the rest of this, what does the Preference
setting "Variable Preservation" do?  Can't find any reference to it in the
User Guide.

Pete
lcSQL Software <http://www.lcsql.com>



More information about the use-livecode mailing list