Evaluate Created Expression Within Function

eval only works in global scope, however, what you want do not seem to be a function but instead a macro, which is basically a function that takes whatever arguments as an expression, at compile time, and return an expression to substitute itself before the code is compiled. Did you look at macros in Julia Manual?

1 Like