Maybe wise to wait to see if that proposal is accepted. FWIW, my last interaction with the core team on operator precedence suggested that they believed that they had arrived at the correct relative precedence values and were not receptive to changing them.<br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 15, 2016 at 12:54 Антон Жилин &lt;<a href="mailto:antonyzhilin@gmail.com">antonyzhilin@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I wonder if it&#39;s worth it to start a new thread right now.<div>We could start discussing, what precedence relationships between opeartors should be, even *before* that proposal is accepted.</div><div>If it&#39;s rejected though, that discussion is going to trash bin.</div><div><br></div><div>- Anton</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-15 19:52 GMT+03:00 Антон Жилин <span dir="ltr">&lt;<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Back to associativity, I see nothing wrong with what  a ?? b ?? c  does. Analogous constructions are found in Ruby, for example. Right associativity exists so that we can do lazy evaluation, computing fallback values only when required. Nothing terrible, again.<div><br></div><div>- Anton</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-15 19:15 GMT+03:00 Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Jun 15, 2016 at 11:07 AM, Vladimir.S via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>&gt;  If precedence between two operators is undefined, we cannot omit<br>
&gt; parentheses.<br>
<br></span>
Hm.. Probably the initial problem could be solved with this? I.e. if we&#39;ll have *no* defined precedence between math operators and between ?? and between ?: (and probably something else?)  ?<br></blockquote><div><br></div></span><div>Sorry, I don&#39;t see it. The initial question was about chaining of ?? operators. That&#39;s a problem with expectations about associativity and not about precedence, right?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<br>
As for rules of precedence, I think it is really not important what precedence will be assigned for ??/?: as in any case IMO most devs will not remember this for sure in situation when one need to write/read such complex expression.<br>
<br>
For me, probably I have some extreme opinion: if we have a mix of operators from different domains (math and ?? for example) we need parentheses to exclude any kind of ambiguity.<span><br>
<br>
On 15.06.2016 17:53, Антон Жилин wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
Nice points, I also think that unless operators are from the same domain,<br>
more parentheses is better.<br>
Other than that, what rules do we need? I can name these:<br>
1. Assignment operators have lower precedence than most operators<br>
2. Arithmetics has higher precedence than comparative and logical<br>
operators. I don&#39;t think that ?? belongs to arithmetics, it&#39;s more like<br>
control flow.<br>
3. Unary operators obviously have higher precedence than everything<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I didn&#39;t read se-0077 in details, so have no opinion. Probably you can<br>
</blockquote>
describe main ideas of it here in two words.<br>
Replace numeric precedence with precedence relationships between pairs of<br>
operators. If precedence between two operators is undefined, we cannot omit<br>
parentheses.<br>
<br>
My thought was basically: &quot;parentheses between some operators must be<br>
enforced by the language&quot; &lt;=&gt; &quot;SE-0077 is needed&quot;<br>
<br>
- Anton<br>
<br>
2016-06-15 17:17 GMT+03:00 Vladimir.S &lt;<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a><br></span>
&lt;mailto:<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>&gt;&gt;:<div><div><br>
<br>
<br>
    On 15.06.2016 16:43, Антон Жилин via swift-evolution wrote:<br>
<br>
        `b + c * d / e` is not, obviously.<br>
<br>
<br>
    obviously, for math operators it seems like we don&#39;t need any<br>
    clarifications<br>
<br>
        `a ? b : c + x + y` -- I&#39;d also say not, because, well, it&#39;s ternary<br>
        operator, the special case that everyone should know (otherwise it<br>
        looks<br>
        like a mess with ? and : operators).<br>
<br>
<br>
    Yes, it&#39;s ternary operator.  But is it<br>
    a ? b : (c + x + y)<br>
    or<br>
    (a ? b : c) + x + y<br>
<br>
    IMO ambiguous.<br>
<br>
        `a ?? x + y + z` -- maybe. If not for analogies with || and &amp;&amp; and<br>
        knowing<br>
        about @autoclosure, I&#39;d say that priority of ?? should be very high.<br>
<br>
<br>
    The same, is it<br>
    a ?? (x + y + z)<br>
    or<br>
    (a ?? x) + y + z<br>
<br>
    ? I.e. I&#39;m not asking, just show that the question is not if we know<br>
    what does ?? mean, but how all the expression will be treated.<br>
<br>
    IMO it&#39;s totally false assumption that most of developers(and poor<br>
    beginners) do remember the the correct precedence in such expressions<br>
    and in most cases will not make a bug and so we should not require the<br>
    parentheses. Imagine how each such expression will be crystal clear<br>
    about the order of processing in *any* Swift source code you could find<br>
    anywhere. IMO this will be great advantage of the language.<br>
<br>
        Now that I think about it, if job of SE-0077 could be done with a<br>
        linter,<br>
        then... do we still need it?<br>
<br>
<br>
    I didn&#39;t read se-0077 in details, so have no opinion. Probably you can<br>
    describe main ideas of it here in two words.<br>
<br>
<br>
        - Anton<br>
<br>
        2016-06-15 16:00 GMT+03:00 Vladimir.S &lt;<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a><br>
        &lt;mailto:<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>&gt;<br></div></div>
        &lt;mailto:<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a> &lt;mailto:<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>&gt;&gt;&gt;:<span><br>
<br>
            As I understand, the question is if<br>
<br>
            `a ?? x + y + z`<br>
            and<br>
            `a ? b : c + x + y`<br>
            (or `b + c * d / e`)<br>
<br>
            an &quot;ambiguous case&quot; ?<br>
<br>
<br>
            On 15.06.2016 15:42, Антон Жилин via swift-evolution wrote:<br>
<br>
                It&#39;s tempting to mention SE-0077 in this context. If it&#39;s<br>
        accepted,<br>
                we will<br>
                be able to make omission of parentheses an error in<br>
        ambiguous cases.<br>
<br>
                - Anton<br>
<br>
<br>
                _______________________________________________<br>
                swift-evolution mailing list<br>
                <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
        &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br></span>
        &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt;<span><br>
                <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
<br>
<br>
<br>
        _______________________________________________<br>
        swift-evolution mailing list<br>
        <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br>
        <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
<br>
</span></blockquote></div></div><div><div><div><div>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
</div></div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div>