<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="">In a discussion about adding $ to the operator character set (it currently is an identifier character), Chris said that any token must be unambiguously either an identifier or an operator even before operators are "discovered", and that's why the identifier character sets and operator character sets have no overlap right now.<div class=""><br class=""></div><div class="">"as" and "is" are not operators, they're keywords that were hard-coded into the grammar.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>

<br class=""><div><blockquote type="cite" class=""><div class="">Le 7 janv. 2016 à 04:31:10, Jo Albright via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</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=""><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 class=""><br class=""></div><div class="">2. potential opportunity to build an educational library to help explain expressions (see below)</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="">infix<span style="" class=""> </span>operator<span style="" class="">&nbsp;plus { </span>associativity<span style="" class=""> left </span>precedence<span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">200</span><span style="" class=""> }</span></div></div><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; line-height: normal;" class=""><span style="font-family: Menlo; font-size: 11px; color: rgb(187, 44, 162);" class="">public&nbsp;</span><font color="#bb2ca2" face="Menlo" class=""><span style="font-size: 11px;" class="">func</span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp;plus </span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">(lhs:&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Int</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">, rhs:&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Int</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">) -&gt; <font color="#703daa" class="">Int</font></span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp;{</span></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span>&nbsp;lhs + rhs</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> totalApples = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>&nbsp;<font color="#31595d" class="">plus</font>&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span></div><div class=""><br class=""></div><div class="">3. potential to write more like a sentence (this isn’t as high of a need, but again a good for entry into the language)&nbsp;</div><div class=""><br class=""></div><div class=""><span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">postfix</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;</span><span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">operator</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;oz {</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;}</span></div><div class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">postfix<span style="" class="">&nbsp;</span>operator<span style="" class="">&nbsp;cup {</span><span style="" class="">&nbsp;}</span></div></div><span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">postfix</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;</span><span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">operator</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;gal {</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;}</span></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font><div class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-family: Menlo; font-size: 11px; color: rgb(187, 44, 162);" class="">public&nbsp;</span><font face="Menlo" class=""><font color="#bb2ca2" class=""><span style="font-size: 11px;" class="">func</span></font><span style="font-size: 11px;" class="">&nbsp;oz&nbsp;</span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">(</span></font><span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; text-indent: -32px;">inout</span><span style="font-family: Menlo, monospace; text-indent: -32px; background-color: rgb(249, 249, 249);" class="">&nbsp;</span><span class="nl" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; text-indent: -32px;">_&nbsp;</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">lhs:&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">) -&gt;&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><span style="font-size: 11px; font-family: Menlo;" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">return</span>&nbsp;lhs</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-family: Menlo; font-size: 11px; color: rgb(187, 44, 162);" class="">public&nbsp;</span><font face="Menlo" class=""><font color="#bb2ca2" class=""><span style="font-size: 11px;" class="">func</span></font><span style="font-size: 11px;" class="">&nbsp;cup </span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">(</span></font><span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; text-indent: -32px;">inout</span><span style="font-family: Menlo, monospace; text-indent: -32px; background-color: rgb(249, 249, 249);" class="">&nbsp;</span><span class="nl" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; text-indent: -32px;">_&nbsp;</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">lhs:&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">) -&gt;&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><span style="font-size: 11px; font-family: Menlo;" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">return</span>&nbsp;lhs *= 8.0&nbsp;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;" class=""><span style="font-family: Menlo; font-size: 11px; color: rgb(187, 44, 162);" class="">public&nbsp;</span><font face="Menlo" class=""><font color="#bb2ca2" class=""><span style="font-size: 11px;" class="">func</span></font><span style="font-size: 11px;" class="">&nbsp;gal&nbsp;</span></font><font face="Menlo" class=""><span style="font-size: 11px;" class="">(</span></font><span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; text-indent: -32px;">inout</span><span style="font-family: Menlo, monospace; text-indent: -32px; background-color: rgb(249, 249, 249);" class="">&nbsp;</span><span class="nl" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; text-indent: -32px;">_&nbsp;</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">lhs:&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">) -&gt;&nbsp;</span></font><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px;" class="">Double</span><span style="font-size: 11px; font-family: Menlo;" class="">&nbsp;{</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">return</span>&nbsp;lhs *= 128.0</div><div style="margin: 0px; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal;" class="">}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><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;totalLiquidInOunces =&nbsp;<span style="color: rgb(39, 42, 216);" class="">5oz</span><font color="#31595d" class="">&nbsp;plus</font>&nbsp;<font color="#272ad8" class="">2</font><span style="color: rgb(49, 89, 93);" class="">cup</span><font color="#272ad8" class="">&nbsp;</font><span style="color: rgb(49, 89, 93);" class="">plus </span><font color="#272ad8" class="">1</font><font color="#31595d" class="">gal</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I spent awhile looking to make sure this hasn’t been proposed before. I apologize if it is a repeat.</div><div class=""><br class=""></div><div class="">Thanks</div><div class="">
<br class="Apple-interchange-newline"><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=""><font color="#8d8d8d" class=""><span class="Apple-converted-space">&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; 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="">Jo Albright</span></font><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=""><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="">
</div>
<br class="">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=iRI3beHTe3UxYAHTlV3lA38zIPfHMhyuRzgTmGKV6k5E-2BmOUZmxMSx5fbKRSHB9THm-2F9b3u-2F93wx1Le-2BtSJn9lBMUq4lkAZh6Ru3YNm-2BHeXjMluHJWu2dX1ad-2BDmGXEgw9H28sle6Um-2BLhKZWgNFQhfjlesTVkXfcK9-2BeflK3vaKpX4WDRKkOjWHaBjDdcFbwwssbtUd6xBT438FxDSbj5Im8v1K45PG8npXU1-2FRHGo-3D" alt="" width="1" height="1" border="0" style="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" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>