Say I have something like this
const BigUnion = Union{Int, Float32}
struct Wrapper{S}
a::S
end
w = Wrapper(3)::Wrapper{Int} # just for clarity
Is there an efficient way to "upgrate" w to a Wrapper{BigUnion}instead?
I've been rebuilding the whole object like:
w_union = Wrapper{BigUnion}(w.a)
but I'm curious to know if there is another way
No, there's not really another way to re-parameterize types other than manually defining what you mean
But what you're doing here should be efficient
Last updated: Nov 27 2025 at 04:44 UTC