Oops, maybe name it differently
function expand(ex::Expr)
if ex.head == :module
Expr(:module, ex.args[1], ex.args[2], macroexpand(ex.args[3]))
else
macroexpand(ex)
end
end
So if someone were to give me:
module M
include("X.jl")
import X: @y, @z
f(x) = X.@y(3)
end
I would then...
eval(:(module M
include("X.jl")
import X: @y, @z
f(x) = X.@y(3)
end)
expand(:(module M ... end))
?
Sorry, not sure how this contextual evaluating/expanding would look like.
It's not clear to me how evaluating the module M will make relevant
definitions accessible to the expand function, since that ignores the fact
that I'm inside module M when expanding each form.