Hi,

I have this quite weird situation:


module Mod

export @generate_macro_f, @generate_function_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()
    @generate_f()
    @generate_g()
end

end

using Mod

h()
g()

I want the function g to be generated using only one call to a function, 
here h (or possible a macro...), outside the module. Such a code would 
return an error saying that @f is not defined, and I don't understand why 
since I escaped the quote block of generate_f. This example is of course 
oversimplified but @f needs to be called inside g.

Any thought?

Many thanks,

Reply via email to