PBP: 018 Breaking by Precedence

This Practice is to break long expressions at lower-possible operators.  It actually says “the lowest possible precedence”.  At a glance, this sounds like a fine idea, and it, in general, is.  The reason given is pretty solid, that you can easily confuse people about precedence by splitting things apart.  This will be even more important on operators people may not be familiar with the precedence of.  (Quiz: Which is higher precedence “&&” or “and”?  Which is higher precedence, “~” or “^”?)

In general, I think this is a positive idea, and am happy to try it.  I do it mostly automatically, but I don’t always get it right.  And I don’t let that worry me, because I don’t think it’s that important.  It’s a good guideline, though, and easy to get used to.


Leave a Reply