[swift-evolution] Handling unknown cases in enums [RE: SE-0192]
rex at remind101.com
Fri Jan 12 19:37:54 CST 2018
Hey Jordan, coming into this a bit late, but it seems like `case #unknown`
is the more flexible syntax regardless of warning or error. If typed errors
are added then it would fall cleanly into catch pattern matching as well it
sounds like. Any thoughts there?
And for the record I'm slightly in favor of an error on unknown matches.
I'm just not sure that breaking source compatibility has been an issue with
enums thus far. It'd be my own preference to throw an error if I intend for
a type to be exhaustively matched, though I can definitely be ok with just
a warning too.
Okay, I went back to `unknown case` in the proposal, but mentioned Chris's
> point very specifically: if the compiler emits an error, we should go with
> `case #unknown` instead. (I'm very strongly in the "warning" camp, though.)
I think the revised proposal is in good shape! (
> https://github.com/apple/swift-evolution/pull/777) I think I've addressed
> everyone's feedback either in the proposal or on-list, if not necessarily
> convinced them. If there are no other major comments I'll let Ted know that
> it's ready to re-run on Monday. Jordan
Rex Fenley | IOS DEVELOPER
Remind.com <https://www.remind.com/> | BLOG <http://blog.remind.com/>
US <https://twitter.com/remindhq> | LIKE US
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution