PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Question regarding variables?

I would like to have your opinions regarding variable names that don't need to be defined to be used.

On small projects it is fine but when you start building bigger projects it might be a problem. Let's say you have a variable named (ThisVar$) and that later on in the program you use it but mispell it (ThsVar$). It would probably take a long time to figure out where the problem is.

I would like to know if I shouldn't allow variables to be used unless being defined within a LOCAL, GLOBAL, PRIVATE or PUBLIC statement.
PointOfLight · 18 Oct 2004, 19:11 UTC
I think you should treat this like Visual Basic does with Option Expicit. Have some sort of flag that if set to 1, you validate variables otherwise you don't. This leaves it in the developer's hands and then it's their responsibility to track down the errors if they don't use it.
So, a compiler directive like #EXPLICIT should solve the problem? I think it's a great way to handle it also.
PointOfLight · 18 Oct 2004, 19:35 UTC
Sounds good to me.