The pass var type static[string] to macro doesn't work for me.
import macros
import json
template evalStr(e: static[string]): untyped =
macro payload: untyped {.gensym.} =
result = parseStmt(e)
payload()
macro checkStatic(strEval: static[string]) : untyped =
echo "passed but not static: ", strEval
evalStr("""var j = %* {"name": "Isaac", "books": ["Robot Dreams"]}""") # this works
echo j # of course happens at compile time what I need
evalStr(strEval) # it doesn't work but should
result = quote do:
echo ""
checkStatic """"var j2 = %* {"name": "Isaac", "books": ["Robot Dreams"]}""""
getting error: Error: type mismatch: got <string> but expected one of: template evalStr(e: static[string]): untyped