From: Phillip Gawlowski Date: 2010-10-15T01:15:41+09:00 Subject: Re: Why does a lot of code not include parenthesis? On Thu, Oct 14, 2010 at 5:37 PM, Chad Perrin wrote: > It takes a little judgment to > write readable code, regardless of the language, and in cases where > parentheses are optional, I find that obsessive adherence to "always use > parentheses" or "never use parentheses" rules are not conducive to > producing the most readable code. In my opinion, parentheses should be used the way they are used in maths: To make an ambiguous statement obvious. For example: 2-x^2 can be interpreted in two ways: either (2-x) gets squared, or only the x gets squared, and the product of this subtracted from 2. Parentheses make the intention obvious: (2-x)^2. It's a simple guide, but it has a lot of repercussions, especially once you take into account precedence of operators (which can allow you to remove or "force" you to add parens). -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.