The trait name of overloadable operators are
&, etc. Their names are certainly meaningful for their original semantic meaning, that is the
+ operator is actually falling into one of the categories from dictionary:
- to unite or join so as to increase the number, quantity, size, or importance:
to add two cups of sugar; to add a postscript to her letter; to add insult to injury.
- to find the sum of (often followed by up):
Add this column of figures. Add up the grocery bills.
- to say or write further.
- to include (usually followed by in):
Don’t forget to add in the tip.
But when I refer
+ operator as string concatenation or
/ operator as path concatenation, then we should rename the
Add trait to
Div trait to
PathConcat or whatever, you name it.
The problem here I think it is the original designer mix some of the semantic into the trait names and function names which are responsible for a much boarder case than its original meaning. And the C++'s
operator+, etc. naming is much more approachable. At least I don’t need to look up the doc when I want to overload an operator. (e.g., Is it