global variables

Rob Cozens rcozens at pon.net
Mon Aug 26 09:54:22 EDT 2002


>>The global keyword is adopted from HyperCard 1.0, and has been a part of all
>>xTalk implementation since.  How else would the engine know whether to treat
>>a variable as local or global without such a keyword?
>
>Presumably it would maintain a list and then every time you used a 
>variable, it would have to check to see if it was in the list.  But 
>once you added a variable to the list, you would never have to add 
>it again, which would be a nice feature.

Whoa Mark,

That would mean every time one wrote a handler one would have to 
check EVERY local variable name to make sure it was not on the global 
list.  This would include handlers in other people's stacks as well 
as your own.

As an aside, just as Revolution has less need to use externals than 
HyperCard, it also has less need to use global variables.  One can 
define local variables that are shared by all handlers in a script 
and whose values persist until the stack is closed.

I was able to replace all globals in my original HyperCard library 
design with locally-declared variables.
-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.com/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the Use-livecode mailing list