-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
When a macro is imported from a foreign module, if a symbol is passed as an argument to that macro and used in an escape clause within a quote clause, the symbol has the macro-source-module name prefixed. This does not seem like desirable behavior.
Example:
julia> module X
macro p(y)
quote
println($y)
end
end
end
X
julia> using X
julia> test = "Hello, world"
"Hello, world"
julia> @X.p(test)
ERROR: UndefVarError: test not defined
julia> macroexpand(:(@X.p(test)))
quote # none, line 4:
X.println(X.test)
endCurrently, this can be avoided by a bit of quote-escape-gymnastics:
julia> module X
macro q(y)
quote
println(:($($y)))
end
end
end
julia> @X.q(test)
Hello, world
julia> macroexpand(:(@X.q(test)))
quote # none, line 9:
X.println(test)
endThis is currently causing bugs and other issues for at least a few users as discussed here and here.
Metadata
Metadata
Assignees
Labels
No labels