<div dir="ltr">Thank you for a helpful answer!<div>I like the idea of overriding precedence from another module. We won&#39;t need to introduce additional keywords or visibility for operators. I will add it to the proposal.<div><br></div><div>I assume you mean precedence inside braces of operator, then operator scope makes sense. Self operator could be omit as well, following the idea that we are introducing a new operator and want to compare it to others:</div><div><br></div><div>infix operator * {</div><div>    associativity: left</div><div>    precedenceLess: ^</div><div>    precedenceEqual: /</div><div>    precedenceGreater: +</div><div>}</div><div>infix operator / {</div><div>    associativity: left</div><div>    precedenceLess: ^</div><div>    precedenceEqual: *</div><div>    precedenceGreater: +</div><div>}</div><div><br></div><div>Equivalent precedence rules would be allowed for symmetry in the operator definitions.</div><div>We would still be able to reopen the scope and add precedence and associativity rules.</div><div>I agree that this scheme has advantage of being a smaller change.</div><div><br></div><div>I&#39;m still concerned about syntax.</div><div>Is it OK to have &quot;less, equal, greater&quot; in precedence name?</div><div>Is it OK to have both curly brackets and dictionary syntax (a precedent, I guess)?</div><div>Is it OK to leave prefix and postfix operators always with empty braces?</div><div><br></div><div>Would it be better to have multiple precedence comparisons at once:</div><div>precedenceGreater: +, -, *, /</div><div>Or one comparison per line will be more readable?</div><div><br></div><div>I will add this to alternatives, but will not swap it with currently stated syntax for now, waiting for some more response.</div><div><br></div><div>What do you think?</div><div><br></div><div>- Anton</div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-04 8:06 GMT+03:00 Maximilian Hünenberger <span dir="ltr">&lt;<a href="mailto:m.huenenberger@me.com" target="_blank">m.huenenberger@me.com</a>&gt;</span>:<br><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 dir="auto"><div></div><div>See inline</div><span class=""><div><br>Am 03.04.2016 um 13:26 schrieb Ross O&#39;Brien via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:<br><br></div><blockquote type="cite"><div><div dir="ltr">There is a problem here of duplicated operators or custom precedence, and how that gets passed between modules.<div>Assume there are three modules, A, B and C. B defines a custom operator **. A and C each define a custom operator ++, and their meanings are different (though, even if their meanings were the same, I&#39;m not sure if they could unify).</div><div><br></div><div>Module D uses A and B as dependencies and sets a custom precedence on ++ and **. Module E uses B and C and has a different precedence on ++ and **. You&#39;re working on Module F which uses D and E. Which ++ and which precedence does F get implicitly?</div><div><br></div></div></div></blockquote><div><br></div></span><div>We could allow operator precedence overriding to resolve ambiguity. However this overriding should only be module internal since it would override the existing precedences in the other modules.</div><div><br></div><div>@AHTOH</div><div>Why do you use #keyword ?</div><div>I think defining a operator with</div><div><br></div><div>    infix operator + {</div><div>         associativity: left</div><div>    }</div><div><br></div><div>is perfectly fine since it is similar to class/struct/enum declaration.</div><div><br></div><div>    // and it&#39;s precedence</div><div>    precedence(+ lessThan *)</div><div><br></div><div>Note the missing &quot;,&quot; and &quot;:&quot; before and after &quot;lessThan&quot; in order to give both operators the same importance <span style="background-color:rgba(255,255,255,0)">(minor issue).</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">I feel that</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">    #precedence(+, lessThan: *)</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">puts too much importance on the first operator.</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">Best regards</span></div><span class=""><font color="#888888"><div><span style="background-color:rgba(255,255,255,0)">- Maximilian</span></div></font></span><div><div class="h5"><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></div></blockquote></div><br></div></div></div></div>