Another possible edge case that I wonder if it's easy to support in your package.
Let's say I want to wrap two unions at once in one type:
@wrapped struct Wrap
a::Union{String,Int}
b::Union{Float64, Float32}
end
f(w::Wrap) = @unionsplit f(w.a, w.b)
Right now I would have to do something like this I think:
struct Two{A,B}
a::A
b::B
end
f(t::Two) = f(t.a, t.b) # can this introduce dynamic dispatch?
const AllCombos = Union{
Two{String,Float64}
Two{String,Float32}
Two{Int,Float64}
Two{Int,Float32}
}
@wrapped struct Wrap
union::AllCombos
end
f(w::Wrap) = @unionsplit f(w)
Would it be difficult to make the field union the default, but allow users to somehow overrule it by using the dot syntax w.a and w.b to choose which field to wrap?
Another possible edge case that I wonder if it's easy to support in your package.
Let's say I want to wrap two unions at once in one type:
Right now I would have to do something like this I think:
Would it be difficult to make the field
unionthe default, but allow users to somehow overrule it by using the dot syntaxw.aandw.bto choose which field to wrap?