<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 7, 2016, at 9:49 PM, Jacob Bandes-Storch 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 dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Some other languages provide special syntax to use a binary function as infix:<div class=""><br class=""></div><div class=""><br class=""></div><div class="">Haskell:</div><div class="">&nbsp; &nbsp; foo a b &nbsp; &nbsp;-- is equivalent to</div><div class="">&nbsp; &nbsp; a `foo` b</div><div class=""><br class=""></div><div class="">Mathematica:</div><div class="">&nbsp; &nbsp; Foo[a, b] &nbsp;(*is equivalent to*)</div><div class="">&nbsp; &nbsp; a~Foo~b</div></div></div></blockquote><div><br class=""></div><div>You could implement the Mathematica one yourself:</div><div><br class=""></div><div>operator infix ~ { associativity left }</div><div><br class=""></div><div>struct Section&lt;T, U, V&gt; { var lhs: T, op: (T,U) -&gt; V }</div><div><br class=""></div><div>func ~&lt;T, U, V&gt;(lhs: T, op: (T, U) -&gt; V) -&gt; Section&lt;T,U,V&gt; {</div><div>&nbsp; return Section(lhs: lhs, op: op)</div><div>}</div><div><br class=""></div><div>func ~&lt;T, U, V&gt;(section: Section&lt;T, U, V&gt;, rhs: U) -&gt; V {</div><div>&nbsp; return section.op(section.lhs, rhs)</div><div>}</div><div><br class=""></div><div>though I don't really see how x `foo` y is a real improvement over x.foo(y).</div><div><br class=""></div><div>-Joe</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div><br class=""><div class="gmail_quote">On Thu, Jan 7, 2016 at 9:42 PM, Chris Lattner via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><span class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 7, 2016, at 5:26 PM, Jo Albright &lt;<a href="mailto:me@jo2.co" target="_blank" class="">me@jo2.co</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap: break-word;" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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=""><div class=""><div class=""><div class=""><div class="">Chris - I really appreciate that you take the time to entertain &amp; respond to proposals.&nbsp;</div></div></div></div><div class=""><br class=""><blockquote type="cite" style="font-weight: normal;" class=""><div class="">On Jan 7, 2016, at 7:24 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 style="word-wrap: break-word;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 7, 2016, at 1:31 AM, Jo Albright via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap: break-word;" class=""><div class="">As my obsession grows with custom operators. I have come across wanting to use small words or 1-2 alphabetical characters as custom operators. I noticed that “as” and “is” are character based operators and figured it wouldn’t hurt to propose the allowance of character based custom operators.</div><div class=""><br class=""></div><div class="">Here are my reasons for allowing them:</div><div class=""><br class=""></div><div class="">1. easier to read “within” vs “&gt;<span style="font-family: Menlo; font-size: 11px;" class="">*</span>&lt;“ or “|<span style="font-family: Menlo; font-size: 11px;" class="">*</span>|”&nbsp;</div></div></div></blockquote><div class=""><br class=""></div></div>Check out Replace Logical Operators (&amp;&amp;,&nbsp;||, etc) with words like "and" and “or":<div class=""><a href="https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md</a></div></div></div></blockquote><div style="font-weight: normal;" class=""><br class=""></div>I completely agree with that proposal being rejected. I am not asking to replace existing language grammar. My desire is for the support of alphabetical characters for custom operators to allow&nbsp;<b class="">third party libraries</b><b style="font-weight: normal;" class=""><span class="Apple-converted-space">&nbsp;</span></b>to have their own unique grammar.<br class="">&nbsp;<br class=""><blockquote type="cite" style="font-weight: normal;" class=""><div style="word-wrap: break-word;" class=""><div class="">There is very small win here of “x foo y” over "x.foo(y)”?</div></div></blockquote><div style="font-weight: normal;" class=""><br class=""></div><div style="font-weight: normal;" class="">And I completely agree that function/method syntax can easily suffice for normal circumstances. Just trying to see how far Swift can be stretched.</div></div></span></div></div></div></blockquote><br class=""></div></span><div class="">Hi Jo,</div><div class=""><br class=""></div><div class="">The rationale is the same - the design of Swift really wants operators and identifiers to be partitioned into different namespaces.&nbsp; Violating that would make it impossible to parse a swift file without parsing all of its imports.&nbsp; This is a mistake that C made (you have to parse all the headers a file uses to reliably parse the file) that we don’t want to replicate in Swift.</div><div class=""><br class=""></div><div class="">-Chris</div><br class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qz6m7-2BHSGYzfIQfSW-2BuN0gBqpHFRkjQ9HVyupfGLXuogvmqXVOM26YtFfoy38VsGF6LTUdk-2BR-2FEVuQqNfmCtT-2F6KltcIGMZUIS3Wk1BnFMRvoH28Ractx1RTbNrWNy1oYNgd65VJch3c-2BOLwL9ch01cs-2FeayrSoTCe5uzyTk-2BBb7Oj5gWartJerl3txp16r3aA-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" 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=""><br class=""></blockquote></div><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RoDF4MveSEMYBIqIJA6ub1g8cOZ-2BVYvqV-2FqygPhjPn9GEf-2FUQ9pEIsLi0Sj4-2F8zvMIGjQv1wAeLcE3CbSagBwEy5kpFna-2B7ZqbwN6Ct7Amty0VJ0hxEHXNS-2FobwQhcuhJwZSuptulvo0J4gaTbxB31ceAr8KLM-2BRcjYhuib3IULfvRGcugvjv-2FZuhNBYIXiqSV6dRWs947NmZnasVddv7Rr-2FIVtuAPML9wnpZe4IpXM-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>