> On Jan 9, 2018, at 4:46 PM, Jordan Rose via swift-evolution
> <[email protected]> wrote:
>
> - FWIW I can't actually think of a use case for using this with `if case` or
> anything else. I'm not against it, but I don't know why you would ever do it,
> just like I don't know why you would mix `case #unknown` with `default` when
> matching against a single value.
if case #unknown = someEnum {
throw MyError.unknownValue
}
…
> That said, it sounds like people are happier with `case #unknown` than
> `unknown case`, and that leaves things a little more consistent if we ever do
> expand it to other pattern positions, so I'll change the proposal revision to
> use that spelling. (And if anyone comes up with a nicer spelling, great!)
I don't love the spelling of `#unknown`—particularly since some enums in the
Apple frameworks actually *have* an ordinary case called "unknown"—but I think
it's a nice, pragmatic solution which slots into pattern matching very nicely.
(And if we ever *do* decide to support @testable enum parameters, we'll already
have the syntax to specify unknown values.)
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution