Enums vs Union Types
Debates on the value, design flaws, and alternatives to enums in programming languages like Go, TypeScript, C#, and others, often preferring union types or sum types for safety and usability.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Does anyone else find that Enum is just not worth using and you’re better off with union types?
enums are handled poorly in so many language. very confusing.
Seconded on Enums. It's annoying that they're not there.
Enums are crap and unsafe use union types.
Note to the next language designer: don't use strings as a substitute for enums.
What's wrong with enums? Enum types in general are very useful.
Unless you use enums, of course.
Isn't this partly why `enum class` was introduced, and is now the idiomatic way to express enums?
Why it make it a string enum then?You can do that in any typed language too.
You just posted a justification to use enums.