Recurrent struct hierarchy

Hi all,

I am trying to create a struct that contains a substruct at different levels. An instance foo of that struct should have the following layout:

foo.a
foo.b
foo.x.a
foo.x.b
foo.y.a
foo.y.b
foo.z

So foo.x and foo.y should contain components a, b of the same type as foo itself.
My list a, b is of course remarkably longer and I would avoid code doubling.

Thanks for any advice

Torsten

See Mixers.jl and CompositeStructs.jl.

julia> using CompositeStructs

julia> struct Struct_abc
         a::Vector{Int}
         b::String
         c::Dict{Char, Float64}
       end

julia> @composite struct FooStruct2
         Struct_abc...
         x::Struct_abc
         y::Struct_abc
         z::Int
       end

julia> x = Struct_abc([2, 3], "b", Dict('x'=>1));

julia> y = Struct_abc([5, 7], "B", Dict('y'=>1));

julia> foo = FooStruct2([1, 1, 1], "this is b", Dict('c'=>1.0), x, y, 42)
FooStruct2([1, 1, 1], "this is b", Dict('c' => 1.0), Struct_abc([2, 3], "b", Dict('x' => 1.0)), Struct_abc([5, 7], "B", Dict('y' => 1.0)), 42)

thanks! CompositeStructs is exactly, what I was looking for. Great!