Disallow numbers as variable names

I found a strange behavior:
if ( value EQUAL 0 )
did not match even if value has the value 0. The cause was, that it seems that there was a variable ${0} which had a value different from 0. The following example demonstrates the behavior:

set ( 0 4 ) # yes it is the digit 0 which is set to 4. In production code this variable came from somewhere else.

set ( value 0 )
if ( value EQUAL 0 ) # evaluated to false
message (“value is equal to 0: ${value}” )
else()
message ( “value is NOT equal to 0: ${value}” )
endif()
if ( value EQUAL “0” ) # evaluated to true
message (“value is equal to 0: ${value}” )
else()
message ( “value is NOT equal to 0: ${value}” )
endif()

A workaround is using the style of the second if-statement using quotes around the critical variable. I dont know where ${0} is set (might be a bug in our code, might be some something set by CMake). We have a lot of code of the first style and it seems to work fine, I fear a ticking bomb, when someone (or some bug) says, that 0 is not 0 any longer, together with the implicit evaluation of the if-statement.

My suggestion: Disallow variable names starting with digits (as most languages do), or at least disallow variable names only consisting of digits. Make a policy to use the old/current behavior.

Similar problem:

Please see this issue: https://gitlab.kitware.com/cmake/cmake/-/issues/23954