Normally I would think that when I return a value from a macro or set the result to that value. There would be no difference. But aparently there is:
import macros
macro testA: string =
result = newLit("testA")
macro testB: untyped =
newLit("testB")
macro testC: untyped =
return newLit("testC")
macro testD: string =
newLit("testD")
macro testE: string =
return newLit("testE")
I get the following error message:
scratch.nim(14, 3) Error: type mismatch: got (NimNode) but expected 'string'
Compilation exited abnormally with code 1 at Fri May 19 14:16:02
I think this is weird, because when I just set result, everything works.