I think we can all agree that you should be allowed to use parentheses whenever it helps you to clarify your meaning. I can also assure you, however, that when you really get into using these operators for heavy math, nesting (((()))) also hinders clarity.<br><br>As always, the question of how much of this choice should be enforced by the compiler and standard library is a nuanced discussion. C, at one extreme, has flourished with a much more complicated set of precedence rules and no enforcement of how parentheses are used. Swift can and already does do better; now, the question is, are even more restrictions better? How much more and how much better?<br><br>My personal opinion is that we have nearly the right amount of rules, with maybe one or two more tweaks at most. Reason: any additional requirements by the compiler and standard library cannot be optionally waived by the user, but a user can always choose to add more parentheses than required. Designers of Swift can help readers of code by _encouraging_ writers of code to improve clarity, but in the end we must design the language for a reasonably well-meaning writer; it's a fool's errand to try to use the standard library to defend clarity against the wishes of an unwilling writer.<br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 2, 2016 at 19:10 Boris Wang <<a href="mailto:kona.ming@gmail.com">kona.ming@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">C is my working language,I don' want to remember too much rules for operator, just use parentheses.<br><br>It's more reliable than the complicated rules.<br><br><br><div class="gmail_quote"><div dir="ltr">Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>>于2016年8月3日 周三05:55写道:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Well, there I disagree. All of these operations take integers and produce other integers. As we've discussed, the bitwise operators resemble multiplication or addition in particular ways; not so different at all. This is IMO a weak argument because you're arguing gradations of "so different", which is entirely subjective in the end.<br><br>What I'm saying is that I would be mildly in favor of your proposal because I can justify it on the basis of something black-and-white: conflicting "levels" at which these operators work on integers (collection of bits vs. element in the set of all integers) and the concomitant differences regarding when these operators trap.<br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 2, 2016 at 16:49 Anton Zhilin <<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-08-03 0:46 GMT+03:00 Xiaodi Wu <span dir="ltr"><<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's not that << will overflow and / will not. Substitute * for / and the argument would be the same. The difference is that << traps when you shift more than the total number of bits but does *not* trap when you shift numbers off as would arithmetic exponentiation; * traps on overflow. Thus, what << is concerned about is the bits (as it should), but * is concerned about the max representable value.</blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Substitute * for / and my argument would also be the same :)</div></div></div></div>
</blockquote></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________</blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><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>
</blockquote></div></blockquote></div>