http://qs1969.pair.com?node_id=98817


in reply to Re: Operator Precedence
in thread Operator Precedence

I guess a corollary of my meditation is that programmers may be purporting to use paranthesis to help document their code, where in fact they are using them because they have not bothered learning the precedence table - and using them "just to be safe".

Once you know the precedence table, this:

$x >= $x_min and $x <= $x_max and $y >= $y_min and &y <= &y_max

...looks the same as this...

($x >= $x_min and $x <= $x_max) and ($y >= $y_min and &y <= &y_max)

...and is no easier to read. In fact I would go so far as to say the last example is slightly harder to read because of the extra parentheses.

In short, I think that no reader benefits from "documentary" parenthesis if they know the precedence table - and a programmer that doesn't should be told to spend the few hours it takes to learn it - rather than the rest of us constantly worrying about them when we code.