10-27-2025, 09:45 AM
(10-27-2025, 09:37 AM)a740g Wrote: While I generally agree that a constant should be know at compile-time, some languages do offer const-qualified objects where a variable becomes read-only after its initial assignment. I think that was the original ask - which is completely valid IMO. QB64 does not have anything like that ATM. But I think it may be a useful feature.
I would think a nice _LockVar could be nice.
DIM foo AS STRING
foo = "Compiled on: " + DATE$
_LockVar foo 'this now says that foo will never change in value, making it read-only. It locks the value of the variable from changing. I can now pass foo to other routines, without having to worry about it being corrupted accidently.
Could also add an _UnlockVar as complimentary usage. It'd basically be similar to locking a file, but for use with a variable instead.

