[swift-evolution] The Non-Exhaustive Enums proposal kills one of Swift's top features - change proposal
2th at gmx.de
Thu Dec 21 12:14:23 CST 2017
> What I’m proposing is that we introduce a new keyword, unknown (or a better name), that serves as a way to handle cases that aren’t yet known, but not those that are.
Afaics, the best this could do is helping when a compiled library using another, updated library with new cases in a switch — but in the common case, that enum would be used in the source code of an app.
So, to be useful, you’ll need some sort of version annotation in your source, or the compiler will not be able to tell which cases have been added since you wrote a switch.
Also, I really don’t think that exhaustive switching on „alien“ enums is one of the best features in Swift (of course, that depends on what count you allow for a feature to be one of the best ;-):
At least, I don’t see big harm in the proposal. I haven’t seen many examples of framework-defined enums that are extended, and used in switch-statements in client code.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution