🕸📝Fergus Duniho wrote on Tue, Jun 21, 2016 09:15 PM UTC:
There is a catch to changing how variable scoping works in GAME Code. It currently supports block scoping. This means that blocks of code that appear between if and endif, do and loop, for(each) and next, or switch and endswitch increases the scope. Since PHP and JavaScript, the two main languages I program Game Courier in, do not use block scoping, I am not used to it, and I do not use it much in GAME Code, though I have used it a little bit. The main advantage to block scoping is that it will let you use variable names in blocks that might have a different use outside the blocks. The advantage to eliminating block scoping is that it allows the interpreter to handle variables more quickly, because there is no searching down levels of scope for the matching variable. Another possible advantage is that it may simplify how variables work, making it easier to add better support for multidimensional arrays. But to make this change, I'll have to check whether scope plays any functional role in how the control structures work.
There is a catch to changing how variable scoping works in GAME Code. It currently supports block scoping. This means that blocks of code that appear between if and endif, do and loop, for(each) and next, or switch and endswitch increases the scope. Since PHP and JavaScript, the two main languages I program Game Courier in, do not use block scoping, I am not used to it, and I do not use it much in GAME Code, though I have used it a little bit. The main advantage to block scoping is that it will let you use variable names in blocks that might have a different use outside the blocks. The advantage to eliminating block scoping is that it allows the interpreter to handle variables more quickly, because there is no searching down levels of scope for the matching variable. Another possible advantage is that it may simplify how variables work, making it easier to add better support for multidimensional arrays. But to make this change, I'll have to check whether scope plays any functional role in how the control structures work.