In erlang 'and' has higher priority than comparisons. So 'is_integer(X) and X > 0' is interpreted as '(is_integer(X) and X) > 0'. 'andalso' has lower priority than comparisons so it is interpreted as we expect.
I really don't understand the aversion?, lack of use? of parenthesis. Back in college (before C++ was released to give you time scale) some C class, spent a lot of time on operator precedence. I was like, why bother? Just use parens, be explicit, clear and never ever have to learn or be bit by any language's precedence ever!
I would argue that the precedence priority is kinda a wat-moment. Most other languages[0][1] have the logical operators `and`, `or` and `not` in the lowest (or near) priority, which makes much more sense IMHO.
If you'd dismiss the above, then I guess one could also argue that JavaScript returning an empty string on `[] + []` is also not a wat moment, but just part of the JavaScript grammar.
It is definitely an oddity that it's and/andalso instead of &&/and.
Similar to the fact that shell and perl swap == versus eq; that causes me no end of confusion switching between the two.
Though nothing will ever be as upsetting as the period when I used QBASIC at school and BBC BASIC at home. Number of times my attempts to use COLOUR compiled first time? Not even once.
C/C++ also have & and | in the wrong place, mostly thanks to their heritage as being overloaded for && and ||).
I've personally seen several (flags & MASK != VALUE) bugs make it to the field. Sometimes it's worked for ages as the 0th bit was part of what was being tested.
Whilst adding more brackets can be useful to explain things, there comes a point when you have too much parenthesis. You have to rely at least a little on operator precedence, so you really do need to learn it.
I always use ',' and ';' in guards. Maybe I'm weird but it feels wrong using the short-circuit operators knowing that guards are always short-circuited anyway. Also they take up too much space :)