Understanding inject pragma

2020-10-12 Thread slonik_az
@exelotl: Thanks a lot! `{.dirty.}` solved the problem, indeed. Moreover, when I make both templates "dirty", I do not need `{.inject.}` any longer.

Understanding inject pragma

2020-10-12 Thread exelotl
Hi! I encountered this recently myself too, you can find some discussion and workarounds here: [#15314 Injected symbols aren't resolved properly in expression passed to inner template](https://github.com/nim-lang/Nim/issues/15314) The most general fix seems to be using the `{.dirty.}` pragma:

Understanding inject pragma

2020-10-12 Thread slonik_az
Hi ALL, I am trying to understand how `inject` pragma works and the following behavior is very surprising let xx = "global xx" template tt_outer(code: untyped): untyped = block: let xx {.inject.} = "(tt_outer) xx"