> you can write "foobar == .someEnum" if you've defined "==" for your enum type
Why wouldn't enums be equatable by default? Why rely on a user implementation of ==? Enums, even with associated data, are rather obvious values, aren't they?
> Enums, even with associated data, are rather obvious values, aren't they?
Associated data can be completely arbitrary (and thus possibly not equatable), I expect the designers would rather people use pattern matching instead of the more error-prone boolean constructs, and likely they don't want to add "unnecessary" capabilities so if the developer don't need equatable enums there's no reason to make them and developers can ask for it when they need it.
Rust makes the same choice, so does haskell, though in both enum/data equality is just a derive/deriving away.
Why wouldn't enums be equatable by default? Why rely on a user implementation of ==? Enums, even with associated data, are rather obvious values, aren't they?