D20180403T180936
echo "before"
import compiler/nimeval
execute("echo 1+2")
this compiles but gives runtime error upon calling execute:
before
Hint: used config file '/Users/timothee/.config/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/timn/nim.cfg' [Conf]
Users/timothee/homebrew/Cellar/nim/0.18.0_1/nim/lib/system.nim(2963, 7) Error: cannot 'importc' variable at compile time
Error: execution of an external program failed: './app '
Also, there's a bug: the absolute path is missing leading /
I couldn't find example usage or unittests
EDIT: seems related to https://github.com/nim-lang/Nim/issues/4953 but the fix suggested there doesn't seem to work
EDIT: workaround: use execShellCmd("nim c ...") with a temporary file; obviously not as good
https://forum.nim-lang.org/t/1319 Generate code at runtime