Strict Compile Mode
pete at lcsql.com
Tue Oct 9 12:28:58 EDT 2012
On Tue, Oct 9, 2012 at 1:48 AM, Ben Rubinstein <benr_mc at cogapp.com> wrote:
> 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.
OK, I now see there's another variable in play - the "Variable checking"
item on the script Edit menu. How does that interact with the "Strict
Compile Mode" Preference setting, if at all?
Still don't understand what "Variable Preservation" was supposed to do
though. It sounds like a different thing than "explicit variables" or
> 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.
I had the same thought yesterday when I was ploughing through several
thousand lines of code adding local statements! It's pretty much an all or
nothing situation unless you choose to temporarily switch off strict
compile mode trusting that you'll remember to switch it back on again at
the appropriate point. Of course, if I'd used strict compile mode from the
beginning, I wouldn't be complaining!
Couple of other questions on variable conventions.
Seems like starting handler local variable names with "t" is pretty common,
although not sure what the "t" represents. Is there a common convention
for naming script local variables?
I also noticed that some folks declare all their variables in one local
statement at the top of a handler while others declare them in the body of
the code right before they are used for the first time. I'm guessing this
is just a matter of personal style and preference but any advantages to
More information about the Use-livecode