3 ms·
In other words: you encode them. That is likely also the reason why many programming languages did not have sums. You have something else that can be used simil
by burakemir 2y ago
In other words: you encode them. That is likely also the reason why many programming languages did not have sums. You have something else that can be used similarly.
A sum type is a disjoint union so a straightforward encoding of A+B would be (tag:bool, A?, B?) in made-up syntax.
When tag==0 then A is present
When tag==1 then B is present
On a different level, the fact that a column can be NULL itself can be considered a sum, like A? = A + {NULL}.