I’m writing a wrapper function for a macro, that can be invoked, for instance as @snoopl "/tmp/a.txt" "/tmp/b.txt" println("Helloworld")
. Now when trying to wrap it, it fails with the error ERROR: UndefVarError: code_block not defined
, which I imagine it means it is interpreting the argument code_block literally, as a symbol (see below). What’s the correct way to define it, and then to invoke it with an arbitrary code block?
function compile_time(code_block)
a = "/tmp/a.txt"
b = "/tmp/b.txt"
@snoopl a b code_block
end
Source code: https://github.com/timholy/SnoopCompile.jl/blob/master/SnoopCompileCore/src/snoopl.jl