Allow (require?) "0x" in environment variable type 3 (hex)

May 20, 2008
10,675
83
Syracuse, NY, USA
Allow (require?) "0x" in environment variable type 3 (hex).

Also, could @VARTYPE show the regex when type is 7.

I like this type (though I don't much care for '0X').

Code:
/t:7:"^0[xX][0-9a-fA-F]+$"
 

rconn

Administrator
Staff member
May 14, 2008
11,952
133
That doesn't make sense - you know it's a regex. You don't know what the regex *is* without a SET, but you don't know the value of any of the other types either without a SET. Why would breaking @VARTYPE be an improvement over simply looking at the variable?

Regarding type 3 - it doesn't really matter if I allow 0x. Everybody who's been using it will have to modify their code to accept it.

Both of these suggestions are breaking changes, and I'm not going to change @VARTYPE to break every batch file / alias that has been using it.
 
May 20, 2008
10,675
83
Syracuse, NY, USA
It will if (as it always has been) the user code reading the variable isn't expecting a leading 0x. Or did you want TCC to always strip a leading 0x? (In which case, why are you entering it?)
If "0x" were allowed (not required) and the user got a "0x" he wasn't expecting, I imagine he must have put it there.

To use a hex number you almost always have to have the prefix (always in the case of @EVAL). It seems easier to to that when a variable is created than every time it's used.