What algebraic properties should new operator methods have?

Operator Precedence and Associativity has syntax rules for various operators and
a footnote says:

The operators + , ++ and * are non-associative.

I am wondering about the semantics of various operator methods.

Are there guidelines about which operators should be commutative: for example, should

a + b == b + a

always hold? Where can I read about the properties that methods of various operators should have, in order to meet users’ expectations?

1 Like