3 ms·
Yeah it's definitely helpful to think of it that way. I usually relate it to sets. Types are sets of possible objects, "+" indicates set-based union, and "*" i
by joeyespo 16y ago
Yeah it's definitely helpful to think of it that way.
I usually relate it to sets. Types are sets of possible objects, "+" indicates set-based union, and "*" is just the Cartesian product of the types.
- munificent 16y ago"+" isn't set union. If it was, int+int would just be int. The extra tag distinguishes it. Raw unions in C are like set union though.
- joeyespo 16y agoRight, it's a tagged union. I mean conceptually. You still end up with the same domain of objects as a union. The tag just tells you which domain you're object is in. (Or which side rather, since the domains can intersect.)