logoalt Hacker News

hobslast Tuesday at 5:46 PM2 repliesview on HN

To be fair Rust doesn't have sum type it has enums, which I feel like you could do in Go, but I haven't read the arguments.


Replies

hmrylast Tuesday at 6:25 PM

Enum is what they call it (perhaps to appear more familiar to C++ programmers?), but from a computer science standpoint they are classic sum types.

9rxlast Tuesday at 5:51 PM

Technically, Rust has sum types (a.k.a. tagged unions) that use an enum to generate the tag. So, while enumeration is involved, sum types is still a better description of what it is.