Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Others have mentioned Protobuf and Capnproto's support. Avro has them too, they're called Union.

It seems that sum types are the norm, actually.



Those do now but I believe that all of them added support years after their initial versions


I think you're incorrect:

Avro had unions in version 1.0 [0], which is from 2012.

Capnproto had unions back in 2013 [1]. That's from the v0.1 days, or maybe even earlier.

Protobuf has had oneof support for about 7 years. They were added in version 2.6.0, from 2014-08-15 [2]. That's still 6 years after the initial public release in 2008, though, so this is maybe what you were thinking of? I don't know too many people who were using protobuf in those days outside of Google, though.

---

[0] https://avro.apache.org/docs/1.0.0/spec.html#Unions

[1] https://github.com/capnproto/capnproto/commit/eb8404a157e074...

[2] https://github.com/protocolbuffers/protobuf/blob/master/CHAN...


Thanks for the references, friend!

And yes, I definitely am primarily thinking of protobuf, as I struggled with this back with version 2.5. I had the (apparently mistakenly) impression that Avro and Cap'n Proto (which I think actually first came out in this timeframe) were about on par.




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

Search: