4 ms·
Do we really need a new name for this? It's basically "safe C-style unions", but pretty much everything in C is unsafe, so you might as well just call it "union
by taneq 9y ago
Do we really need a new name for this? It's basically "safe C-style unions", but pretty much everything in C is unsafe, so you might as well just call it "unions".
- Fufjeudndh 9y agoIt's not a new name, just one you're unfamiliar with.
- saurik 9y agoThis is not a new name... in the theory of algebraic data types there is a model of what it means to add and multiply types, resulting in "sum" and "product" types. I am not 100% sure but I believe these terms have been used since the early 70s. The term "union" as used in C is highly related but not quite the same. If you add a tag to the union (and so have a "tagged union", often represented in C as a struct with an enum and a union) then you are equivalent in an information sense (but the usage is still different, as a C union says something very specific about how memory is used).
- Taniwha 9y agoas mentioned elsewhere 'union' originally came from Algol68 where (eventually) they were implemented exactly as described in the article
- nixpulvis 9y agoNames are evil, abolish yourself of all naming and achieve true enlightenment!