<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 Nov 27, 2016, at 7:03 PM, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" 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=""><br class=""></div><div class="">On Nov 26, 2016, at 23:52, Robert Widmann &lt;<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@gmail.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class="">Under the old behavior they must have <i class="">identical</i>&nbsp;declarations, that includes precedence. &nbsp;We specifically had to modify the precedences of some stuff in Operadics to match Runes because of this and it worked just fine.</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 27, 2016, at 12:43 AM, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Nov 26, 2016, at 22:02, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:<br class=""><br class=""><br class="">on Sat Nov 26 2016, David Sweeris &lt;<a href="http://davesweeris-at-mac.com/" class="">davesweeris-AT-mac.com</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Nov 26, 2016, at 17:19, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">Just gotta field a version of that proposal that doesn’t “look like Haskell” :)<br class=""></blockquote>Is there something wrong with Haskell's approach to imports? I don't<br class="">know how they do it, so I'm unaware of any pros/cons to their<br class="">approach. The ":)" makes me think I'm missing something...<br class=""><br class=""><blockquote type="cite" class="">Seriously, though, would there be any objection to restoring the old<br class="">behavior of just silently ignoring perfect duplicates of operator<br class="">definitions across frameworks sans proposal?<br class=""></blockquote>Yeah, it could silently change how statements get evaluated, if I<br class="">start writing code using one library's operators, then import a 3rd<br class="">library which defines the same operators but with different<br class="">precedences.<span class="Apple-converted-space">&nbsp;</span><br class=""></blockquote><br class="">differnt precedences =&gt; not perfect duplicates, right?<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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="">That's a good question... I don't know... The compiler keeps track of functions by their "fully qualified" name, i.e. "MyLib.+(Int, Int)-&gt;Int", right?<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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-caps: 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's syntax only allows us to declare precedence on a per-operator basis. Does the compiler track precedence on a per-function basis anyway, and if so, how would you specify which precedence you want at the call site? Aside from parentheses, I mean.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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-caps: 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="">- Dave Sweeris</span></div></blockquote></div></div></blockquote><br class=""><div class="">I don't know what "operatics" or “runes” are. Based on the context I’d <i class="">guess</i> they’re two parts of the standard library, but I'd like to be sure.</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>Operadics and Runes are libraries that export nothing but operator declarations. &nbsp;The former is put out by my org.,&nbsp;<a href="https://github.com/typelift/Operadics/commit/c65e6355e22282a89d68a8a2d594a32c36c1e7b0" class="">TypeLift</a>,&nbsp;he latter is put out by&nbsp;<a href="https://github.com/thoughtbot/Runes" class="">ThoughtBot</a>.</div><br class=""><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="">Either way, though, I'm not sure this addresses my primary objection (which I wrote the wrong way around in my earlier email). Suppose a library does this:</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">//ALib</span></div></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">infix</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">operator</span><span style="font-variant-ligatures: no-common-ligatures" class=""> • : MultiplicationPrecedence</span></div></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">IntegerArithmetic</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {...</span>}</div></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;• &lt;T: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">IntegerArithmetic</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt; (lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, rhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt; {&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> rhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">map</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {lhs <font color="#3d1d81" class="">*</font></span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;$0}&nbsp;</span>}</div></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + &lt;T: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">IntegerArithmetic</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt; (lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, rhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt; {</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> rhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">map</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {lhs </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">+</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> $0} }</span></div></div></blockquote><div class=""><div style="margin: 0px; line-height: normal; min-height: 14px;" class="">And another library does this, which is an easy copy/paste error to make, since everything still works as long as you only test single-operator expressions:<span style="font-variant-ligatures: no-common-ligatures" class=""></span></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">//ABuggedLib</span></div></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">infix</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">operator</span><span style="font-variant-ligatures: no-common-ligatures" class=""> • : AdditionPrecedence</span></div></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font color="#008400" face="Menlo" class="">//Some&nbsp;convenience functions for getting Ints into your Doubly goodness</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> • (lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">, rhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt; {</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> rhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">map</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(lhs) * $0}&nbsp;</span>}</div></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + (lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">, rhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt; {</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> rhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">map</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(lhs) + $0}&nbsp;</span>}</div></div></blockquote></div></div></blockquote><div><br class=""></div><div>I’m gonna cut you off right here: These are not identical declarations and were an error under even the old scheme of things. &nbsp;This is not what we are talking about.</div></div><div class=""><br class=""></div></body></html>