While adding compatible unions (#67) we've added a selector attribute that allows the union selector to be manually specified. However we haven't yet added selector support for ordinary unions. The reason being that ordinary union support is not needed for the implementation of compatible unions, and it's slightly non-trivial to decide how to combine automatic selector allocation with manual specification, e.g. what does this do?
#[derive(Encode)]
#[ssz(enum_behaviour = "union")]
enum Union {
#[ssz(selector = "1")]
A(A),
B(B),
}
Is it A=1, B=0? or A=1, B=1 and an error?
Or maybe we should say that if any selectors are manually specified then all must be (I think I like this the most).
While adding compatible unions (#67) we've added a
selectorattribute that allows the union selector to be manually specified. However we haven't yet addedselectorsupport for ordinary unions. The reason being that ordinary union support is not needed for the implementation of compatible unions, and it's slightly non-trivial to decide how to combine automaticselectorallocation with manual specification, e.g. what does this do?Is it A=1, B=0? or A=1, B=1 and an error?
Or maybe we should say that if any selectors are manually specified then all must be (I think I like this the most).