Page 1 of 1
Declaration of Variable Option
Posted: Fri Mar 01, 2024 3:31 pm
by Randy
Option to require variables to be declared in the script or by compiler option. Something like
@OPTIONS {DeclareVariable = True} or compiler opt -DeclareVariable.
Re: Declaration of Variable Option
Posted: Sun Mar 03, 2024 10:04 pm
by airsoftsoftwair
Actually, I've thought about something like this several times but then decided against it because this has the potential to cause lots of trouble, e.g. 3rd party includes containing some library code etc. could stop working if they aren't designed to be compatible with a mode that requires declaration of variables and there are several other tricky issues to consider here so this is unlikely to come.
Re: Declaration of Variable Option
Posted: Thu Nov 14, 2024 3:15 am
by Randy
How about using preprocessor directive? Like @IFUNDECLARED ERROR or @IFUNDECLARED WARNING directive. This would limit the scope of the check to just code inside @IFUNDECLARED.
example:
@IFUNDECLARED ERROR
code.....
@ENDIF
Re: Declaration of Variable Option
Posted: Sat Nov 23, 2024 12:15 am
by airsoftsoftwair
Yeah, but I think there are lots of other potential issues when making variable declaration a must. I've definitely been experimenting with this already in the past but then encountered some issues that made me drop the idea again, even though I don't remember exactly what it was. All I know is that the idea to add a variable declaration option has been around for some 15+ years or so.