4 ms·
"required" is an example of making an invalid state representable and having it ruin your program.
by srtjstjsj 6y ago
"required" is an example of making an invalid state representable and having it ruin your program.
- dodobirdlord 6y agoYea, a better example of making invalid state unrepresentable in Google’s protocol buffers is to use the “oneof” feature to mark that a set of fields are mutually exclusive. If A, B, and C are mutually exclusive you can put them in a oneof, which also saves space in the binary representation. If in future you discover that A and B but not C needs to be a valid state, you can add a 4th AB option inside of the oneof.