I am trying to write a custom benchmarking macro, but as a first step I cannot seem to write even a trivial macro that transparently executes an arbitrary expression. Specifically if the expression is a variable assignment, the variable is not set in local scope.
Example:
macro donothing(ex::Expr)
return ex
end
Returns:
julia> @donothing z=1
1
julia> z
ERROR: UndefVarError: z not defined
I’ve tried wrapping the expression in esc() and quote blocks to no avail. This seems really basic but I can’t seem to find an answer. Thanks in advance!