Re:gRPC-Web is going GA
by superfrank on Wednesday October 24, 2018 @06:08PM
(#18296902)
Can you give me an example where generics would be helpful? I'm not doubting you, my brain is just a little slow today and I'm struggling to think of a scenario where I feel I would NEED them for gRPC.
[ Parent
| on HN ]
Re:gRPC-Web is going GA
by deathanatos on Wednesday October 24, 2018 @06:41PM
(#18297091)
Option<T>.
Protobuf "supports" this particular case via other means: messages are always implicitly nullable, and the WKTs cover primitives, which don't count as messages.
Map<K, V>: Protobuf has dedicated syntax for this case.
Generics and user defined types make it easier to represent more complicated data. Now everyone is just going to have to write custom encoders and decoders to get the data to a Protobuf compatible format, which is pretty much what we do right now with JSON.
If you haven't used algebraic/sum types before, I highly recommend trying them out. Once you use them you won't want to go back.