<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 Jan 8, 2016, at 2:43 PM, Dennis Lysenko &lt;<a href="mailto:dennis.s.lysenko@gmail.com" class="">dennis.s.lysenko@gmail.com</a>&gt; wrote:</div><div class=""><p dir="ltr" class="">Jo, maybe it's time to explore infix functions as a potential solution? I don't see infix functions under the commonly proposed list. </p></div></blockquote><div>I just added them. &nbsp;To repeat what has been said several times on this thread, the problem being solved here is not important enough to be worth complicating the language for.</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class="">
<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Jan 8, 2016, 4:28 PM&nbsp;Jo Albright via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">I promise, this is my last idea to be thrown at this. Instead of characters in operators...<div class=""><br class=""></div><div class="">Would the core team be open to having an <b class="">operatoralias</b> keyword that allows an operator to be masked by an identifier.</div><div class=""><br class=""></div><div class="">Learning &amp; Teaching Example :</div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class=""><span style="" class=""><br class=""></span></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class="">operatoralias<span style="" class="">&nbsp;plus = +</span></div></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><span style="color:rgb(187,44,162);font-family:Menlo;font-size:11px" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(187,44,162)" class="">let</span>&nbsp;apples =&nbsp;<span style="color:rgb(39,42,216)" class="">5</span>&nbsp;+&nbsp;<span style="color:rgb(39,42,216)" class="">5</span></div></div></div></div><span style="font-family:Menlo;font-size:11px;color:rgb(187,44,162)" class="">let</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;</span><span style="font-family:Menlo;font-size:11px" class="">apples =</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">5</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;plus</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">5</span><div class=""><font color="#272ad8" face="Menlo" class=""><span style="font-size:11px" class=""><br class=""></span></font></div><div class="">With extension :</div><div class=""><br class=""></div><div class=""><span style="font-family:Menlo;font-size:11px;color:rgb(187,44,162)" class="">let</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;</span><span style="font-family:Menlo;font-size:11px" class="">apples</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;=&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">5</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;.&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(49,89,93)" class="">plus&nbsp;</span><span style="font-family:Menlo;font-size:11px" class="">(&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">5</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;)</span></div><div class=""><br class=""></div><div class="">---------------------------------------------------------------------------------</div><div class=""><div class=""><br class=""></div><div class="">Learning &amp; Teaching Example :</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class="">operatoralias<span style="" class="">&nbsp;</span><span style="" class="">incrementedBy</span><span style="" class="">&nbsp;= +=</span></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)" class="">updatedValue<span style="" class=""> += </span><span style="color:#272ad8" class="">10</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)" class="">updatedValue<span style="" class="">&nbsp;</span><span style="" class="">incrementedBy</span><span style="" class="">&nbsp;</span><span style="color:#272ad8" class="">10</span></div></div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">With extension :</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><span style="color:rgb(79,129,135);font-family:Menlo;font-size:11px" class="">updatedValue</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;.&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(49,89,93)" class="">incrementedBy&nbsp;</span><span style="font-family:Menlo;font-size:11px" class="">( <font color="#272ad8" class="">10</font></span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;)</span></div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">---------------------------------------------------------------------------------</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">Readability &amp; Code Reduction Example :</div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)" class=""><span style="color:#bb2ca2" class="">typealias</span><span style="" class=""> Point = (x:&nbsp;</span>CGFloat<span style="" class="">,y:&nbsp;</span>CGFloat<span style="" class="">)</span></div></div><div style="margin:0px;line-height:normal" class=""><br class=""></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class="">infix<span style="" class=""> </span>operator<span style="" class=""> &gt;&gt;&gt;&gt; { }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#bb2ca2" class="">func</span> &gt;&gt;&gt;&gt; (lhs: <span style="color:#703daa" class="">CGContextRef</span>?, rhs:&nbsp;<span style="color:rgb(79,129,135)" class="">Point</span>) -&gt;&nbsp;<span style="color:rgb(112,61,170)" class="">CGContextRef</span>? {</div></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">&nbsp; &nbsp; <span style="color:#3d1d81" class="">CGContextMoveToPoint</span>(lhs, rhs.<font color="#703daa" class="">x</font>, rhs.<font color="#703daa" class="">y</font>);&nbsp;<span style="color:rgb(187,44,162)" class="">return&nbsp;</span>lhs</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">}</div></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""></div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><span style="color:rgb(187,44,162);font-family:Menlo;font-size:11px" class="">operatoralias</span><font face="Menlo" class=""><span style="font-size:11px" class="">&nbsp;moveTo = &gt;&gt;&gt;&gt;&nbsp;</span></font><font color="#008400" face="Menlo" class=""><span style="font-size:11px" class="">// operator alias for custom operator</span></font></div></div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(61,29,129)" class=""><span style="color:#bb2ca2" class="">let</span><span style="" class=""> context = </span>UIGraphicsGetCurrentContext<span style="" class="">()</span></div></div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(61,29,129)" class=""><span style="color:rgb(79,129,135)" class="">context</span><span style="" class="">&nbsp;moveTo&nbsp;</span>(<span style="color:rgb(39,42,216)" class="">10</span>,<span style="color:rgb(39,42,216)" class="">10</span>) addLineTo&nbsp;(2<span style="color:rgb(39,42,216)" class="">0</span>,2<span style="color:rgb(39,42,216)" class="">0</span>) strokeWith&nbsp;<span style="color:rgb(112,61,170)" class="">UIColor</span>.redColor()</div></div><div class=""><br class=""></div><div class="">Or if SVG letters used (less readable, but also less footprint) :</div><div class=""><br class=""></div><div class=""><span style="font-family:Menlo;font-size:11px;color:rgb(79,129,135)" class="">context</span><span style="font-family:Menlo;font-size:11px" class="">&nbsp;M&nbsp;</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">(</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">10</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">10</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">) L&nbsp;</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">(2</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">0</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">,2</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">0</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">) stroke&nbsp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)" class="">UIColor</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">.</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">redColor()</span></div><div class=""><br class=""></div><div class="">I know this looks a lot like a chained method and very close to the same amount of code to be written… however it is slightly easier to read without all of the function punctuation in between :</div><div class=""><br class=""></div><div class=""><span style="font-family:Menlo;font-size:11px;color:rgb(79,129,135)" class="">context</span><span style="font-family:Menlo;font-size:11px" class="">.moveTo</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">(</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">10</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">10</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">)?.addLineTo</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">(2</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">0</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">,2</span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">0</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">)?.strokeWith.(</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)" class="">UIColor</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">.</span><span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px" class="">redColor())</span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I believe there is an opportunity here that won’t truly be appreciated until it is in use. But will not argue that it is very close to what is currently available and does not have a huge impact in the current vision of things.</div><div class=""><br class=""></div><div class="">Thanks for humoring my imagination. :)&nbsp;</div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class=""><font color="#8d8d8d" class=""><span class="">&nbsp;</span>Nerd . Designer . Developer</font></span><font color="#464646" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Jo Albright</span></font><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">
</div>
<br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 8, 2016, at 2:26 PM, Chris Lattner &lt;<a href="mailto:clattner@apple.com" target="_blank" class="">clattner@apple.com</a>&gt; wrote:</div><br class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Jan 7, 2016, at 9:49 PM, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" target="_blank" class="">jtbandes@gmail.com</a>&gt; wrote:<br class=""><br class="">Some other languages provide special syntax to use a binary function as infix:<br class=""><br class=""><br class="">Haskell:<br class=""> &nbsp;&nbsp;&nbsp;foo a b &nbsp;&nbsp;&nbsp;-- is equivalent to<br class=""> &nbsp;&nbsp;&nbsp;a `foo` b<br class=""><br class="">Mathematica:<br class=""> &nbsp;&nbsp;&nbsp;Foo[a, b] &nbsp;(*is equivalent to*)<br class=""> &nbsp;&nbsp;&nbsp;a~Foo~b<br class=""></blockquote><br class="">Ok, then yes, introducing a magic syntax would be technically feasible (though not backticks, since they are used for something else).<br class=""><br class="">This is still extremely unlikely to be accepted though.&nbsp; Additional language complexity needs to pay for itself, and the win here is so small that it doesn’t seem worth it.<br class=""><br class="">-Chris<br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=8CZIdLciSFC-2BO5jF-2FiP8qN7dBFsgCUZ50wdTsolcRPcEmhP8zqcLl0BiyM8aEFtlIyoSNLzZKyz7AnwH2lWx8DFyCnjXphQhqkIIVikLfRJB6kOkIVFh5cFUcRXGqQRRl-2BR8DbsbiNN7cgxFN1J2dSZcxalKvGD64V4iA0wWw-2BKCUBPALcJj2-2BAD2xf0VvW2M4pN8aa0nu5TJldW2wAD6ogJojEuyKDgX4jOj3nK-2BCY-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
</div>
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>