I am trying the following:
1. The following works: a.nim
template test*():untyped =
const
a* = "hello"
echo a
test()
2. But the following doesn't: a.nim
template test*():untyped =
const
a* = "hola"
include b
test()
b.nim
echo a
Is the second version not possible? Do I have to use a macro for that or can I get away with the template somehow?
I don't know why but tend to get stuck in a problem and then find the solution shortly after I post in the forum.
https://forum.nim-lang.org/t/3199
The solution:
template test*():untyped =
const
a* {.inject.} = "hola"
include b
test()