Unions of isbits types are not directly isbits in Julia 0.7/1.0 so they need more specific support if we want to use them with Blobs.jl.
References:
I expect Blobs will need to do something like this:
Julia now includes an optimization wherein "isbits Union" fields in types (mutable struct, struct, etc.) will be stored inline. This is accomplished by determining the "inline size" of the Union type (e.g. Union{UInt8, Int16} will have a size of 16 bytes, which represents the size needed of the largest Union type Int16), and in addition, allocating an extra "type tag byte" (UInt8), whose value signals the type of the actual value stored inline of the "Union bytes".
Given that the optimization is specific to fields and that the tag is not part of the Union itself, I'm not quite sure if copying can be avoided though when the union is used?
Unions of isbits types are not directly isbits in Julia 0.7/1.0 so they need more specific support if we want to use them with Blobs.jl.
References:
I expect Blobs will need to do something like this:
Given that the optimization is specific to fields and that the tag is not part of the Union itself, I'm not quite sure if copying can be avoided though when the union is used?