Hacker News new | ask | show | jobs
by randomdata 596 days ago
> Rust has sum types, implemented as Enums

Do you mean implemented with enums? Enums themselves are not a type. They are a mechanism for value generation, providing automatic numbering (hence enumeration) for constants. Indeed, they, like all values, are ultimately represented by a type, but that type can range from something like a simple integer or something more complex like a tagged union (typically with the generated value being the tag) with different ecosystems favouring different type approaches.

1 comments

I think they just mean that sum types are defined by the programmer using the `enum` keyword
Like how subroutines are implemented as Functions.

And by Functions you don't mean functions, but rather the letters fn?

That is certainly an interesting way to communicate.