From the manual:
*may seem like a surprising choice to users of languages that provide
+for string concatenation, this use of
*has precedent in mathematics, particularly in abstract algebra.
+usually denotes a commutative operation, where the order of the operands does not matter. An example of this is matrix addition, where
A + B == B + Afor any matrices
Bthat have the same shape. In contrast,
*typically denotes a noncommutative operation, where the order of the operands does matter. An example of this is matrix multiplication, where in general
A * B != B * A. As with matrix multiplication, string concatenation is noncommutative:
greet * whom != whom * greet. As such,
*is a more natural choice for an infix string concatenation operator, consistent with common mathematical use.
Sometimes I define my own operator methods. Should I use
+ only for commutative operations?