|Welcome to the Monastery|
Re: Re: Operator Precedenceby tomazos (Deacon)
|on Jul 22, 2001 at 17:58 UTC||Need Help??|
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.