<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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=""><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 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; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">IntegerArithmetic</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" 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 style="margin: 0px; line-height: normal; min-height: 14px;" class=""><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">You write your code like this:</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 class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="color: rgb(0, 132, 0);" class="">//SomeFile.swift</span></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">import</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ALib</span></div></span></div></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">...</span></div></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(39, 42, 216);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> x = </span><span style="font-variant-ligatures: no-common-ligatures" class="">1&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">+&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures" class="">4&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">•&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">[</span><span style="font-variant-ligatures: no-common-ligatures" class="">1.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures" class="">2.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures" class="">3.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]</span><span style="color: rgb(0, 0, 0); font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><span style="color: rgb(0, 132, 0); font-variant-ligatures: no-common-ligatures;" class="">//[5, 9, 13]</span></div></span></div></blockquote><div class=""><div style="margin: 0px; line-height: normal;" class="">Then six months later, for whatever reason — maybe it has some useful type or something — you decide that some other file needs to import ABuggedLib:</div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class=""><span style="color: rgb(0, 132, 0);" class="">//SomeOtherFileInYourProject.swift</span></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;ABuggedLib</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">...</span></div></div><div style="margin: 0px; line-height: normal;" class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="color: rgb(0, 132, 0);" class="">//SomeFile.swift</span></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">import</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ALib</span></div></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">...</div></div><div style="margin: 0px; line-height: normal;" 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; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> x = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">+&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">•&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3.0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">] </span><span style="font-variant-ligatures: no-common-ligatures" class="">//silently changes to [5, 10, 15], even though neither this line, nor the file it’s in, have been touched in six months</span></div></div></blockquote><div style="margin: 0px; line-height: normal;" class=""><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">The compiler won’t even give you an "ambiguous statement” error because the function in ABuggedLib takes an Int, which is a better match than the correctly-precedenced generic version in ALib. This “bug" might even be extra maddening, since I <i class="">think</i> it won’t actually show up until you either clean your project or touch “SomeFile.swift”… Potentially, there could be <i class="">lot</i> of time between cause (importing ABuggedLib) and effect (x’s value changing).</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">Dunno, maybe this isn't as big of an issue as I’m making it out to be... I don’t have any solutions for detecting when it happens, other than for IDEs to alert you whenever adding an import statement changes how code that’s already written would be compiled (this isn’t "Xcode-evolution", though, nor would it help people who use other editors).</div></div><div style="margin: 0px; line-height: normal;" class=""><div class=""><br class=""></div><div class="">I guess I’m really just arguing that operators <i class="">and their precedences</i> should be part of whatever name collision resolution scheme we come up with, and I don’t recall the old behavior doing that (I could be wrong there).</div><div class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">- Dave Sweeris</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">P.S. Relatedly, what’s&nbsp;the precedence of the dot product function here, anyway? If there’s a rule about “operators always take the highest precedence they can find” or something, I’m unaware of it.</div><div class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">import</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">&nbsp;ALib&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">//declares • with MultiplicationPrecedence</span></div></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;ABuggedLib&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">//declares • with AdditionPrecedence</span></div></div><div style="margin: 0px; line-height: normal;" class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font color="#008400" face="Menlo" class="">//doesn’t need a operator declaration, since it’s already in an imported library</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" 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:&nbsp;</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:&nbsp;</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;, rhs:&nbsp;</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;&nbsp;</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; {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">guard</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;lhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">count</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;== rhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">count</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="">else</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;{&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);" class="">"Dimension mis-match"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) }</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&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="">&nbsp;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);" class="">0</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;..&lt; lhs.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">count</span><span style="font-variant-ligatures: no-common-ligatures;" class="">).</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="">&nbsp;{lhs[$0]&nbsp;</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="">&nbsp;rhs[$0]}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div></span></div></blockquote><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Or am I mistaken about not needing to provide my own operator declaration in this case?</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div></div></body></html>