-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hygiene of named function objects #25955
Comments
julia> @macroexpand @noeffect function (f::foo)()
println("no effect")
end
:(function (Main.f::Main.foo)()
#= REPL[5]:2 =#
(Main.println)("no effect")
end) julia> macro noeffect2(e)
return esc(e)
end
@noeffect2 (macro with 1 method)
julia> @macroexpand @noeffect2 function (f::foo)()
println("no effect")
end
:(function (f::foo)()
#= REPL[7]:2 =#
println("no effect")
end) See https://docs.julialang.org/en/stable/manual/metaprogramming/#Hygiene-1 Please use the forum at https://discourse.julialang.org list for usage question |
I agree that this seems to be a usage question — and using But it does seem like there's an issue here. I would expect the hygiene of julia> @macroexpand @noeffect (f::foo)() = f
:((Main.f::Main.foo)() = begin
#= REPL[4]:1 =#
Main.f
end)
julia> @macroexpand @noeffect g(f::Foo) = f
:((Main.g)(#5#f::Main.Foo) = begin
#= REPL[6]:1 =#
#5#f
end) |
Agreed, this is a hygiene bug. |
shouldn't this macro have no effect?
but it raises error if you use it to this function
Version Info
The text was updated successfully, but these errors were encountered: