> On 25 Oct 2016, at 08:13, Rien via swift-evolution > <[email protected]> wrote: > > I have tried to like this because at first it seems like a good idea. > But having let it shimmer for a while, I simply cannot muster the enthusiasm > for it. Using “~=“ does not ‘feel’ right to me. Especially for a code > breaking change at this stage. There are probably already a number of user > defined functions out there that overload “~=“. > -1. Sorry.
Erica chose ~= because it is already the pattern matching operator in Swift. I think it would be just fine. > > If possible, I think it would be nice to make the “case” after the “if” or > “guard” optional. But that would be enough imo. > Alternatively replacing the “~=“ with a different keyword (and dropping the > “case”) could also do trick, as Haravikk suggested (I do like the “matches”). I don’t like Haravikk’s suggestion because although he calls it a keyword, "matches” would clearly be an operator and in many discussions the idea of using words as operators has been rejected for practical compilation reasons and readability reasons. The idea of using matches because it reads better in English is bogus because, once an operator becomes widely accepted, people read it as what it is. If you see `a || b`, you don’t read "a pipe pipe b", you read "a or b”. I admit I do read "a == b" as "a equals equals b” but that seems completely natural to me. Also, reading things in English is not necessarily natural to a lot of programmers. I am +1 for Erica’s idea, although I also like the =~ modification to turn the value and the pattern around. _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
