JuliaVariables.jl
JuliaVariables.jl copied to clipboard
Macro arguments are treated as globals
It seems that macro arguments are treated as globals (see @global x)
julia> solve(:(macro f(x) end))
:(macro (@global f)(@global x)
#= REPL[12]:1 =#
end)
Compare this to a function:
julia> solve(:(function f(x) end))
[]function (@global f)(@x)
#= REPL[13]:1 =#
end
Also, macro (@global f) is a bit hard to use. Would @global var"@f" make sense?
macro is not handled as well.
Do you have a better idea of implementing the functionalities this repo tries to achieve? Just need help indeed.
I get that macro calls Expr(:macrocall, ...) are not supported (as mentioned in README) and it perhaps is impossible to do it without implementing Julia interpreter. But isn't it a bit easier to process macro definitions Expr(:macro, ...)? I think you can process macro f(...) ... end as if it were function var"@f"(...) ... end? I think I can do this by pre-processing Expr before passing it to solve. But it would be great if JuliaVariables.jl does this out-of-the-box.
Yes, I think processing macro definition is not difficult. I'm going to implememt this, thank you!!