Strict Compile Mode
benr_mc at cogapp.com
Tue Oct 9 03:48:00 CDT 2012
On 08/10/2012 21:15, Peter Haworth wrote:
> 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.
> It also seems that sometimes LC constants have to beenclosed 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.
We thought those things were constants (as empty is); it turns out that they
were really literals (although the dictionary describes them as keywords). I
think the script editor colouring is the same as for any other quoted string.
> 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.
It's effectively nullified by what I think is a bug
It should be what you set so that you're always in 'explicit vars' mode by
default. However, since the menu item "Variable checking" is sticky between
launches, it is now as far as I know meaningless.
What would be really useful (as requested in above RQCC report) is to make the
setting sticky per script (with the preference then affecting new scripts).
This would enable one to be 'virtuous' by default, but not unduly
inconvenienced when working with old or contributed code. The problem I find
is that if I have to fix eg a bug in a library, that's not 'explicit vars
clean', I need to switch off the setting. I may then forget, and lose the
protection when I'm working on more modern scripts.
Sadly you can no longer vote for reports in RQCC...
More information about the use-livecode