I just spent 20 minutes trying to find an annoying bug in my program. The cause of the bug? I accidently used the variable ‘i’ in a for loop instead of ‘i__’. For now, let’s just accept that I have to use global variables and weird names such as i__. It’s part of the requirements of the current project on which I’m working. Anyway, this is a bug that could occur in any number of situations where global variables are present. So, we need a way to quickly hunt and destroy these bugs.
My proposed solution? For any programming language that you work in, you should have a utility that allows you to quickly identify variables within a certain scope and to see what type of value they might contain. This would have allowed me to select the function I was working on and notice that there was an extra variable ‘i’ that was initialized as global.
I can think of another situation in which this type of tool would be handy. It could be used to add macro writing capabillites (ala lisp) to any desired language. It already has full knowledge of the constructs of the language and the functions and variables that exist. And so long as the macro could be compiled to the desired language, macro functionality would be available. Maybe you’ll see this sort of tool available here in the future.