3 ms·
for sure. It would also be lovely to add sum types to Protobufs too, while we're at it. many message protocols are very neatly described with sum types in my
by arianvanp 8y ago
for sure. It would also be lovely to add sum types to Protobufs too, while we're at it. many message protocols are very neatly described with sum types in my opinion.
Also, errors would be way more elegant as a sum type:
instead of:
err, a := x
if err != nil {
}
we can do:
switch a {
Err(err) -> {},
Ok(a) -> {},
}
and avoid null pointers :) and then "check" is literally just "bind/ try!, flatMap, =<<" or however your language du jour calls it :)
- mayoff 8y agoRegarding Protobufs, did you mean something other than `oneof`? https://developers.google.com/protocol-buffers/docs/proto#oneof https://developers.google.com/protocol-buffers/docs/proto#on...