Is this a bug (related to scoping / nested macros)?

48 views
Skip to first unread message

Marius Millea

unread,
Sep 25, 2016, 6:57:20 PM9/25/16
to julia-users
I can't figure out why this doesn't work:

julia> macro outer()
           quote
               macro inner
()
               
end
               
@inner
           
end
       
end


julia
> @outer
ERROR
: UndefVarError: @inner not defined



Could it be a bug (I'm on 0.5) or am I missing something about how macros work?

Yichao Yu

unread,
Sep 25, 2016, 7:12:18 PM9/25/16
to Julia Users

It's not a bug, the whole expression needs to be expand we before it's evaluate so the macro is not defined yet

Reply all
Reply to author
Forward
0 new messages