Hacker News new | past | comments | ask | show | jobs | submit login

The big problem I've found is serialization of sum types. thrift (or protobuf or any number of similar systems) is very good at serializing most of the data one tends to work with, with declarations that are suitably strict but easy to write. But it doesn't have a good way to represent "this field is an A or a B".



Thrift has unions, so does Apache Avro. Afaik Protocol Buffers is the only one where you have to string together one yourself with a required tag and a bunch of optionals.


Protobufs has unions now too (they're called "oneofs"), as of version 2.6.0 released last year:

https://github.com/google/protobuf/releases/tag/v2.6.0


Protobuf has somewhat recently added the 'oneof' feature which tries to deal with these union types.

The one downside I found when trying to use it was that the 3rd-party C# Protobuf libraries didn't yet support it.

See: https://developers.google.com/protocol-buffers/docs/proto#on...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: