I don't know what your exact use case is, but you should't be using macros like that.
Does @inline g() suit your purposes? If not, I recommend making your example a bit more pertinent to what you want accomplished. On Friday, January 22, 2016 at 3:43:10 PM UTC-5, ami...@gmail.com wrote: > > 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, >