by kenshaw · 7y ago · 0 comments
Check out releases here: https://github.com/gunk/gunk/releases/tag/v0.1.0
Please note this is still extremely early / alpha stage, but we are soliciting feedback on our initial design. We hope to make this project useful to the greater developer community.
type MyEnum int
const (
MYENUMVAL MyEnum = iota
)
It's a philosophical argument, but one should not design a protocol using "oneof". I believe that's a relic from proto2, and I'm not aware of any modern APIs published by Google, that make use of "oneof" in anything but a legacy capacity. Gunk is not for old protobufs, it's for new development. It works with and integrates cleanly with existing protobuf definitions.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.
https://developers.google.com/protocol-buffers/docs/proto3#o...
I think the feeling is that this is the realm of business logic, and a protocol should be simple and fast and not concern itself with the rules part of the underlying service.
Oneof seems to fall under the same concept, where it says "one and only one field from this list" when they can just as easily do that in service or client logic (three fields, documentation and a server response custom written as to the WHY of oneof relationship)
Neither the syntax nor build process for protocol buffers has ever seemed particularly difficult.
You mentioned something about cognitive load, but even as a Go developer this looks like it would add to my cognitive load. I have to learn/remember this new syntax and learn/remember the (imperfect) ways in which it maps to protocol buffers, etc.
I could really use some concrete examples of the ways this is better.