Hacker News new | past | comments | ask | show | jobs | submit login

I have never seen this called a "union", and that's certainly not what people mean when they speak of a "tagged union".



What do you think tagged unions are? What languages are you referring to?

F# calls these discriminated unions. OCaml calls them variants or tagged unions.

https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

https://ocaml.org/docs/basic-data-types#variants


Huh. I was thinking about this in much lower level terms, it seems weird to me to define these structures recursively when how they're actually stored is thus omitted yet that's actually crucial, but I guess if you work in a sufficiently high level system you don't care about the implementation details.


It is exactly what they are. ‘Tagged’ or ‘discriminated’ unions are a set of named product types - the name being the tag/discriminator.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: