macro instantiate(typ)
           quote
               struct $typ
               end
               $typ()
           end |> esc
 end
tt = @instantiate(TT) # this is ok
julia> f(x) = begin
           @instantiate NN
       end
ERROR: syntax: "struct" expression not at top level
is there an expression which allows struct to be evaluated at top level, the other part in the function scope
so that this works out?
THanks