Game Development Community

For global vars % for normal scope

by Thomas Natale · in Torque Game Engine · 07/29/2005 (5:18 pm) · 2 replies

Being a heavy PHP programmer... I find it very difficult to get accustomed to typing a % before variable names.. since all php variables start with $... I was just wondering why the choice was made to make local scope variables begin with % and only global vars start with $?

What would have to be done to the source code to swap the two ? ( I know it might be difficult lol)

#1
07/29/2005 (6:05 pm)
Cuz it disambiguates the semantical searches that need to happen. If you want to switch I suggest by starting by finding every instance of $ and %... ;)

It's defined in a few places in the script code; and the $ is used in the C++ code a bit to reference globals. I bet you could make the switch in a week. Of course, then you'd be totally incompatible with any other Torque code out there. :)
#2
07/29/2005 (6:08 pm)
Haha! of course, the old incompatibility!

It really wouldn't be worth it.. lol

Thanks for replying.. I was just curious..