▲ | instig007 5 days ago | |||||||
> This was my experience in Google Search infrastructure circa 2005-2010 [...] > Reports from other large teams at google > teach everyone how that works, etc. > Or we could just tell people to wrap the thing in a `message` It really sounds like a self-inflicted internal google issue. Can you address the part where I mention isomorphism of (oneof token) and (oneof (token {})), and clarify what exactly do you think you'd have to teach other engineers to do, if your protocol's encoders and decoders took this property into account? | ||||||||
▲ | kentonv 5 days ago | parent [-] | |||||||
You seem to have merged the required fields issue and the oneof issue, but these are unrelated threads. > Can you address the part where I mention isomorphism of (oneof token) and (oneof (token {})), and clarify what exactly do you think you'd have to teach other engineers to do, if your protocol's encoders and decoders took this property into account? What you have written is not a serious proposal in terms of a working way to extend Protocol Buffers to allow repeated oneofs. What you have written is a very complicated way of saying: "You theoretically could support extensible repeated oneofs, with the right type system and protocol design." Yes, I know that. With a clean slate, we can do anything. But in the real world (yes I'm going to keep saying that, since you don't seem very familiar with it), you don't get to start from a clean slate every time you don't like how things have turned out. As it stands, the product type in protobufs is `message`, the sum type is `oneof`, and the vector type is `repeated`. The way `oneof` is encoded on the wire is exactly one of the tags appear. The way `repeated` is encoded on the wire is that the same tag appears many times. The way `message` is encoded is that it's a length-delimited byte blob that contains a series of tag-values inside. Unfortunately, this encoding means if we supported `repeated oneof`, it would not be extensible. So we ban `repeated oneof`, and say "you need to write a repeated message, where the message contains a `oneof`". This isn't as pretty as people might like but it works just fine in practice and we move on to more important things. | ||||||||
|