"@generated" for structs?

I was playing with code that generates a struct + accompanying code, based on a set of information that can be represented with groups of symbols. It occurred to me that I could simplify the syntax around this stuff if I could do something like, for example:

@generated struct MyStruct{A::Symbol, B::Tuple, C}
        fields = collect(:($(esc(param))::C) for param in B.parameters)
        constructors = begin [do some stuff with A and C] end
        return quote
              $fields
              $constructors
       end
end

Is there anything like this in Julia? And if not, is there a good reason, or is it just an idea nobody has gotten to? I don’t really understand the inner workings of @generated functions yet.

I don’t think something like dynamically changing the fields of a struct depending on the type parameter is possible, my guess is it would make the compiler’s job significantly more complex. But if what you want is to more or less splice the fields of one type (your B type above) into the fields of another (your MyStruct) you might find this useful: GitHub - marius311/CompositeStructs.jl