>>In HyperCard you were supposed to avoid using global variables, if >>possible. Is this also true in Revolution? > >Avoid using them in Hypercard? I never ever heard of this! I've >created many many programs in Hypercard, and use global variables a >lot. Global variables are a GOOD thing in Hypercard, if you keep >proper track of them, empty them out when no longer needed, and so >forth. > >Shari C >--
Shari, Here are some quotes from folks more knowledgeable than I: Scripting: from Tricks of the HyperTalk Masters by Jeanne A. E. DeVoto: One disadvantage of using global variables is that they continue to use memory space, since they're not forgotten when you leave the handler. This doesn't matter if you use only a few global variables to store small amounts of data, but if you have used a global to hold a large amount of information, it will lock up a significant amount of memory. This memory is unavailable to HyperCard for other operations. Fourth World Scripting Style Guide (recent version) Helpful tips for xTalk, Lingo, and other 4GLs by Richard Gaskin When you write your handlers, try to make them as generalized as possible. If you can avoid using global variables do so, since anything dependent on other routines will reduce the chances of being able to use this routine again in the future. If you only need to read a value in a global, consider passing it into the handler as an argument instead. Hypertalk 2.0 by Winkler & Kamins: "Use Globals Sparingly" page 688. I would have to retype this, so I won't, but their concerns include losing track of what is in the global or reusing it for another purpose somewhere else in your system. They recommend passing parameters instead. ----- What prompted my question was that I find globals much simpler than passing parameters and I wanted to know if there is any downside. From re-reading the above, I guess the negatives would be the same as for HyperCard. You seem to guard against most of these negatives, based on your message. Bruce -- Bruce Lewis Lewis & Collyer 160 John Street, Suite 401 Toronto, Ontario Canada M5V 2E5 (416) 598-4357 FAX (416) 598-1067 [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
