No. The crossing of compileTime / runtime boundary with `{.compileTime.}` var
is completely unreliable and has many many bugs.
I'm in favor of removing it to return to the situation 6 months ago.
Workaround
# Declare separate var for compile-time and runtime
var CT_x {.compileTime.} = false
var x: bool
# Compile time processing
static:
CT_x = true
# Cross the compile-> runtime boundary (and enforce CT evaluation)
x = static(CT_x)
# Runtime processing
echo x
Run
AFAIK allowing {.compileTime.} variableq to exist at runtime was only added to
allow taking addresses of const arrays (as you can't take addresses of const).
I'm convinced it's a bad solution and it has already started to bite us. It's
not tested and I'm not even sure there a case that works today.
Related:
*
[https://github.com/nim-lang/Nim/issues/6947](https://github.com/nim-lang/Nim/issues/6947)
*
[https://github.com/nim-lang/Nim/issues/12216](https://github.com/nim-lang/Nim/issues/12216)
*
[https://github.com/nim-lang/Nim/pull/12799](https://github.com/nim-lang/Nim/pull/12799)