> Allowing the omission of a default case in an exhaustive switch makes the
> addition of a new case to the enum a breaking change.
Depending on the context, even with a default the change might be breaking —
but without giving notice to the framework client!
Additionally, it would feel very strange for me to have a default clause for
bool-like enums* or other examples where there can't be any additional cases.
When there are two types of enums, the proposal makes sense for the
"open"-ones; but I'm not sure if I like the concept of having two kinds of enum.
- Tino
* tiny anecdote: I actually have seen the equivalent of this
func reallyExhaustive(input: Bool) {
if input == true {
print("true")
} else if input != true {
print ("not true")
} else {
print("just to be save")
}
}
in the wild… but I don't remember the comment I wrote ;-)
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution