The futures crate already provides an either for that case.
1 Like
Yes, but impl Trait
is not just for futures. It is now a core language feature, should have good library support as well.
1 Like
I think we should consider extending the language with anonymous sum types instead.
A lot of the frunk crate is essentially a hack around that.
3 Likes
A|B types?
1 Like
Huh. I’d’ve thought the syntax would be more like:
let x = (&str, i32, i32)::2(1);
match x {
<x>::0(s) => ...,
<x>::1(i) => ...,
<x>::2(j) => ...,
}
But okay… (this would be the opposite of a tuple - while a tuple’s attribute operates on values (t.0, t.1, etc), a summer’s attribute operates on types (T::0, T::1, etc))
(alternatively it wouldn’t support repeated types at all and construction and matching would be trivial)
1 Like
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.