[swift-evolution] [Proposal] Invert the order of pattern match operator

Brent Royal-Gordon brent at architechies.com
Fri Apr 8 05:32:22 CDT 2016


> Can someone fill me in as to how this differs from (0…4).contains(x)?
> 
> Personally I don’t like the choice for the operator, and think it’s not very clear, if we can do the same thing with a method then I’d prefer removing the operator to be honest.

~= is the way you customize how a type behaves when it's a pattern in a switch statement. So ~= (_: Range<T>, _: T) is responsible for making `case 1..<10` work properly. Removing it would be...unwise.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list