you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 2 months ago

Never said that. In fact, enums have lots of issues that can add a lot of boilerplate code.

But actually having data associated with the type system instead of just a flag is a lot more powerful and less prone to errors than classic enums

You can also put functions on this union type that allows easy abstraction of what state the union is in

  • source
  • parent