Check If Variable Exists
Blitz3D Forums/Blitz3D Beginners Area/Check If Variable Exists
| ||
Hi. Is there a command in Blitz3D that enables strong-typed-like syntax checking? Many typos made me lose a lot of time trying to figure what was wrong. And that still happens every now and then. And, when you are very tired, you probably will not notice the diference between: xPosition = 10 and xPsoition = 10 So, I need something like that. Maybe it is a feature that can be enabled in the current version of the software. If not, please allow me to suggest the inclusion of such capability, in the next release. Of course I understand that this will force me to declare all local variables before using them, as well. Some may argue that that would no longer be a BASIC compiler, but please, consider how useful that feature would be. And, come on, who in the world never made a mistake and got very upset when (s)he found out that it was a minor typo that made him/her lose hours (or days, perhaps), trying to figure why things were not working? Thanks a lot, /R |
| ||
You will be interested in these threads: OPTION EXPLICIT - PLEASE!! New Blitz Preprocessor Blitz Preprocessor Released As Open Source Knock yourself out. =) |
| ||
Who says GOSUBs are "bad"? I use them all the time, and can hardly ever figure why I should bother with a Function. |
| ||
Variables inside a Function do not "pollute" outside of the function, but if they were previously declared as "Global". Thus, you can use in a same programm several functions that all use inside variables with identical names (ie. XPlayer, for instance) without bothering that the operations you do on XPlayer in your "MoveShip" function modify the XPlayer in the "DrawRadarMap" function the next time you call it. It is very comfortable. |
| ||
If you're interested, I've written a program (in BB, source code included) to try and spot typing mistakes. It searches for variable names that are almost similar (the definition of "almost" can be adjusted). It also shows all names occuring in the input so you can check them manually (noting names that occured only once; these might just be typos!). Maybe this tool is helpful if all else fails, or a funny way to spend a rainy Thursday evening. http://www.oprit.rug.nl/prins13/download/typofinder.zip |