Wednesday, May 16, 2007

When syntax highlighting affects coding practices

In eclipse, using the php extension, both 'and' and 'or' get colored in a bold dark purple, but && and || don't. Normally, the symbols are interchangeable in my head, I've coded for long enough by now, but I find myself preferring 'and' and 'or', just because it makes my code look more readable to me due to the syntax highlighting. Unfortunately, there's a difference in meaning, the operator precedence goes like:
||, &&, ... =, ... and, or
which could be a problem for me if I'm not paying attention some time in the future, and expect the wrong behavior. (And is also kinda goofy, this is why we use parenthesis)

o.O

No comments: