[swift-evolution] Redundant parentheses should result in compile errors.

Amir Michail a.michail at me.com
Sat Dec 5 12:42:44 CST 2015


Generally speaking, people put parentheses in expressions not to improve readability but because they can’t remember certain operator precedences and don’t want to bother looking them up.

> On Dec 5, 2015, at 1:40 PM, Adrian Kashivskyy <adrian.kashivskyy at me.com> wrote:
> 
>> 2 + 3 % 4 * 5 is not at all readable for me without parentheses.
> 
> Agree, it's neither readable, nor predictable, because of the operator precedence. That's why I don't understand why should one omit parentheses in such cases. I'm -1 on this for now. 
> 
> Pozdrawiam – Regards,
> Adrian Kashivskyy
> 
>> Wiadomość napisana przez Nicky Gerritsen <nickygerritsen at me.com <mailto:nickygerritsen at me.com>> w dniu 05.12.2015, o godz. 19:36:
>> 
>> 
>>> On 5 dec. 2015, at 19:33, Amir Michail <a.michail at me.com <mailto:a.michail at me.com>> wrote:
>>> 
>>> This isn’t just a style issue.
>>> 
>>> Rather, it would force programmers to remember operator precedence better thus resulting in fewer bugs.
>> But is this not also often used to make “bigger” expressions / conditions more readable?
>> I think already the example from https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-ID41 <https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-ID41> is a good example
>> 2 + 3 % 4 * 5 is not at all readable for me without parentheses.
>> 
>> -- Nicky
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151205/50ce4fc0/attachment.html>


More information about the swift-evolution mailing list