Unpopularity of global variables - why?
Bob Sneidar
bobs at twft.com
Fri Oct 12 17:25:48 EDT 2012
On Oct 12, 2012, at 1:50 PM, Graham Samuel wrote:
> The discussion about Strict Compile Mode brought in a lot of stuff about globals, and I sense that many people think they're a bad thing - I am not talking about trick ways of using them, just regular globals that allow one to refer quantities (numbers, strings, anything really) across scripts which are housed in different objects in the same program (set of stacks).
Across ALL stacks in the IDE. That is the rub. If you only work on one application at a time, well and good. But what about library stacks? What about plug-ins? Use as a global something a plugin also uses as a global, and you could really begin to screw things up royally.
I don't think that globals are a bad thing, but I do think they should only apply to the stack they are defined in, or else have another class of globals called stack or application globals (or how about both!). That would solve the vast majority of cross globalization. (Hey I think I coined a new term!
Bob
More information about the use-livecode
mailing list