Page 1 of 1

Question regarding variables?

PostPosted: Oct 18, 2004 @ 7:46pm
by kornalius
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.

PostPosted: Oct 18, 2004 @ 8:11pm
by PointOfLight
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.

PostPosted: Oct 18, 2004 @ 8:30pm
by kornalius
So, a compiler directive like #EXPLICIT should solve the problem? I think it's a great way to handle it also.

PostPosted: Oct 18, 2004 @ 8:35pm
by PointOfLight
Sounds good to me.