I went through the similar questions to overload the behavior of built-in operator, like How to overload the operator "*" as KroneckerProduct. The answers given there are usually to use new operator, instead of touching the built-in ones, as it might break how things work by default.
Defining a new infix operator works to a degree, especially at narrower context. But a remaining problem is there'll just be more and more different operators to be defined when the context expands. So I think a better way would be to re-use the existing ones if possible (give them new meaning for new context, without introducing ambiguity and breaking existing behaviors).
With that, I think of string. They're different from numbers, so is it possible to expand the behavior of built-in operators like "+" on strings? so that its behavior can be expanded when the operands are strings, and not breaking the default behavior:
In:= "ab" + "ac"
Out= "abac"
In:= 1 + 1
Out= 2
In:= "ab" > "ac"
Out= False
In:= 1 > 2
Out= False
upvalues
, might be helpful. $\endgroup$<>
. I would not try to overload+
for this purpose. I believe that the risk that something will be severely broken by this change is very high. $\endgroup$<>
works for string concatination. But the fact one has to use a different operator in different context is not ideal, as explained in the question. We'll just end up with a tons of different operators, and each works for a different purpose. I've updated the question description to cover more purposes to highlight this. $\endgroup$