Macro for generating struct

It sounds like you actually want to use eval() or @eval, in which case you don’t need a macro at all.

julia> function make_type_named(name)
         @eval struct $name end
       end
make_type_named (generic function with 1 method)

julia> make_type_named(:hello)

julia> x = hello()
hello()
2 Likes