Thanks for the hint, the macro becomes simpler and better:
macro expandToFile(filepath: string, body: typed): untyped =
result = body # optional
writeFile($filepath, repr(body))
Maybe a similar mod could be applied to the
[source](https://github.com/nim-lang/Nim/blob/master/lib/core/macros.nim#L1124)
of `expandMacros` but I'm not sure of all the implications.
Trying again with a devel compiler instead of 0.17.2 gets rid of the
indentation bug:
let rows = 9
proc testproc(s143025: string) =
echo [&(s143025, ": ", $rows)]
testproc("string")
Name mangling is not very convenient but I guess that it can't be avoided.
There remains the broken `echo` syntax, should I file a bug against this?