Explicit Variables again

Joe Lewis Wilkins pepetoo at cox.net
Thu Oct 18 14:34:16 CDT 2012


Richard,

When this recently occurred when I started reworking one of my old projects, I was non-plussed, having actually forgotten how to declare vars explicitly. (smile) With my very poor vision I started looking for instances in which I had done so in the past and could not find any. So I am very pleased that this topic has surfaced on the list. I could not find any explanation that I could read in the Dictionary or the User's Guide. I've been avoiding using VARs so far by referencing containers. Not always very easy and, obviously, much slower. Guidance please?

Joe Wilkins 

On Oct 18, 2012, at 11:45 AM, Richard Gaskin wrote:

> 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
> 
> _______________________________________________
> 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