There's a package to do this in Julia: https://juliaarrays.github.io/StructArrays.jl/stable/