Thanks to both of you, I actually solved my problem in the mean time by calling @eval, as Yiacho suggested, working code for the record:
module Mod
export g, h
macro generate_f()
return esc(quote
macro f(name)
return quote
print($name)
end
end
end)
end
macro generate_g()
return esc(quote
function g()
@f("hello")
print(" world\n")
end
end)
end
function h()
@eval @generate_f()
@eval @generate_g()
end
end
using Mod
h()
g()
