Explicit Variables again

Richard Gaskin ambassador at fourthworld.com
Thu Oct 18 14:45:18 EDT 2012


I wouldn't worry too much about making your scripts "compliant" with 
explicitvars.

There are probably some users who run with it on, but not many.

The IDE itself doesn't really use it except during compilation only, it 
seems - here's where the dizzyingly long chain of commands that gets 
invoked when you click "Apply" finally sets the script, handled here in 
button "Template Editor" of stack "revscripteditor.rev":


command scriptCompile pObject
    lock screen
    lock messages

    local tOldPreserveVariables, tOldExplicitVariables
    put the preserveVariables into tOldPreserveVariables
    put the explicitVariables into tOldExplicitVariables
    set the preserveVariables to sePrefGet("preserveVariables")
    set the explicitVariables to sePrefGet("explicitVariables")

    local tScript
    scriptGet pObject
    put the result into tScript

    local tResult
    set the script of button "revCompileObject" of me to tScript
    put the result into tResult

    if tResult is empty then
       put the revAvailableHandlers of button "revCompileObject" of me 
into sHandlerList
    end if

    set the preserveVariables to tOldPreserveVariables
    set the explicitVariables to tOldExplicitVariables

    # The script should be unset because it could cause issues with idle 
handlers
    set the script of button "revCompileObject" of me to empty

    unlock messages
    unlock screen

    return tResult
end scriptCompile


IIRC, explicitvars were seen as too cumbersome to work with, since as a 
truly global property the required that EVERYTHING you're using comply 
with it, and too many plugins didn't.

So rather than require every developer to comply with the requirements 
of explicitvars just in case, they came up with that clever trick of 
turning it on only during compilation, and immediately turning it back 
off again (or to whatever its value was, which is usually off since most 
folks who turn it "on" do so from Prefs, where it's not really "on" 
until that moment of compilation.

In brief, I'd just blow it off and move on to other tasks....

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list