Instead of @eval @f ex_func this eval(Main, @f ex_func)
might do that. I cannot test what you do with julia 0.5 because functions are now very diferent internally. @eval @f ex_func will be X.eval(@f ex_func) thus there will be X namespace but not outside of the module as shown from macroexpand.