<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 24 Oct 2016, at 21:55, Haravikk via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 24 Oct 2016, at 21:38, Martin Waitz via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">When using a pattern match operator, I’d prefer to reverse its arguments:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;if value matches pattern …<br class=""><br class=""> &nbsp;&nbsp;&nbsp;if result =~ .success(let x) { use(x) }<br class=""><br class="">Being used to pattern matching in functional languages, I also do like our current syntax.<br class="">Using ~= together with `let` on the left looks very strange to me.</div></div></blockquote><br class=""></div><div class="">That's interesting point, it does kind of make more sense that way round, but I wonder if we were to d that a keyword might be even better than an operate, like:</div></div></div></blockquote><div><br class=""></div><div>Should read as; "that's <b class="">an</b> interesting point, it does kind of make more sense that way round, but I wonder if were to <b class="">do</b> that if a keyword might be even better than an <b class="">operator</b>"</div><div>i.e- like a sane person who proof-reads e-mails might have written it.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if result matches .success(let x) { use(x) }</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if result matches let x? { use(x) }</font></div><div class=""><br class=""></div><div class="">And so-on? Maybe matches isn't the right keyword; we could even re-use the is keyword for something shorter (and just think of a type as a form of pattern)? I could like the idea of doing:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if result is let x? { use(x) }</font></div><div class=""><br class=""></div><div class="">My reasoning being that a keyword makes it much more obvious what's going on as it can read like natural language to convey that it's a form of matching, wheres ~= as an operator still requires some learning if you've not seen something similar in another language.</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>