Re:Gunk: Modern front end and syntax for Protocol Buffers
by kenshaw on Saturday January 19, 2019 @01:53AM
(#18945716)
In proto3 all fields are optional. As such, I don't see the need for "oneof" since you should check in business logic whether or not the field is there. By using "oneof" you are declaring two different types can be the same name. It's a philosophical argument that you're free to disagree with.
Re:Gunk: Modern front end and syntax for Protocol Buffers
by joshuamorton on Saturday January 19, 2019 @02:22AM
(#18945796)
In good proto2, all fields are optional, that doesn't negate the uses of one of, which provide compile time validation instead of runtime, which is the important part.
From a safety perspective, tagged union types, which oneofs are, are incredibly useful and really should be used more often.
[0]: https://github.com/googleapis/googleapis/search?q=oneof&unsc...
[1]: I have no idea what this repo actually does, to be honest, but it appears authoritative about something, and appears to be public grpc apis Google exposes.