This is from tutorial
import macros
macro debug(x: varargs[untyped]): typed =
result = newStmtList()
for s in x:
var slit = s.toStrLit
var stringExpr = slit.repr
echo stringExpr & " okay"
result.add newCall("write", newIdentNode("stdout"), slit)
result.add newCall("write", newIdentNode("stdout"), newStrLitNode(":
"))
result.add newCall("writeLine", newIdentNode("stdout"), s)
var x = 1
proc one(): int = 1
debug(1+1) # prints 1 + 1: 2
debug(x+1) # prints x + 1: 2
debug(one() + 1) # prints one() + 1: 2
What's the problem with toStrLit you have?