If you write the following you'll get a compile-time error:
const a = myTable[33]
echo a
This isn't terribly convenient. Marginally more so is:
template try_const(expression:typed):auto =
## Evaluate an expression at compile-time if possible.
when compiles((const c = expression)):
const c = expression
c
else:
expression
echo try_const myTable[33]
Better still would be a version of echo that implicitly runs try_const on all
arguments. It may be possible with the varargs[type, converter] syntax
mentioned [here](https://nim-lang.org/docs/manual.html#types-varargs). I get
the feeling it may work better as a macro that wraps its arguments.