Questions tagged [union-types]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
111 views

Challanges to integrate sum types into json/protobuffer/toml/yaml? [closed]

What challenges might arise when integrating sum types into data exchange or configuration file formats such as json, protobuf, toml or yaml?
Jw C's user avatar
  • 131
12 votes
4 answers
445 views

Prior art on modeling characters of variable lengths

In some encodings such as UTF-8, characters are of variable length in bytes. It's a bit like a tagged union, but the exact size could be computed, so the next element in a string could follow ...
user23013's user avatar
  • 2,220
3 votes
4 answers
1k views

What are pros and cons of tagged vs untagged union-types?

Some languages accept untagged union types (C++, C, etc): union Something { char ch; int i; }; Some languages accept tagged union types (like Haskell). ...
nchistov's user avatar
  • 1,585
3 votes
2 answers
688 views

Why do most languages prefer complex enum instead of simple enum?

I don't know the standard words for these, but: complex enum is like enum { E1(t1: T1, t2: T2, ...), E2(...), ... } simple enum is like ...
molikto's user avatar
  • 171