
21 Feb
2010
21 Feb
'10
8:17 p.m.
But I agree they should all be legal, i.e. that unary minus should bind more tightly than any infix operator (as in C).
I'd just like to interject that I disagree, and think that the current behaviour is about as good as one could hope for. Negation is an additive operation, and thus has lower precedence than multiplication and exponentiation. -x^2 must be interpreted as -(x^2), not as (-x)^2. Similarly, though it seems to confuse some people, it makes more sense that - x `mod` y is parsed as - (x `mod` y) since mod has to do with multiplication, so it should bind more tightly than additive operations. - Cale