News for hackers. Stuff that matters.
Re:Typical: Data interchange with algebraic data types by stepchowfun on Sunday May 21, 2023 @08:29PM (#36026025)
This is a Typical concept. I haven't seen this approach to optionality for sum types in any other serialization framework.

Programmers have good intuition for what it means for a field in a struct to be optional: it's either there or it's not. But for a sum type, what does it mean for a case to be "missing"? It's not quite as obvious, but it helps to think about what responsibilities are placed on writers vs. readers: optionality for a struct relaxes the burden on writers (they don't have to set the field), whereas for a sum type the burden is relaxed on readers (they don't have to handle the case).

There are no comments on this comment yet.