>"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
Some people put a small "g" in front of the global variables names to differentiate them from local variables, such as: global gName,gDate,gAddress I don't bother as I always name my local variables with short, memorable names that I use from program to program. One of my favorites is to put some letter before "it". I may have a handler with five local variables: bit, git, pit, sit and wit. Since I do this across the board, I know when I see a variable with "it" that it's local. I also use "temp" and other very generic terms for local variables. Global variables, on the other hand, I name very carefully, so that the name tells me what's in them. I suspect many of the warnings are to deter folks are who just starting out from delving into areas they may confuse themselves with, or not keep track of. -- --Shareware Games for the Mac-- http://www.gypsyware.com http://www.gypsygames.com
