Well, there is always the limited form of arithmetic overloading which Ken Thompson added to his compiler:
C# has had extensive operator overloading from day 1, and the only instance of (mild) abuse that I can think of is the use of implicit conversions from strings in XLINQ. It really is mostly down to culture, I think.
Re:Zig, the Small Language
by 1980phipsi on Wednesday September 07, 2022 @01:36PM
(#32753597)
What about something like R's custom infix operators? R has %*% for matrix multiplication (and a few other built-in ones), but you can define your own %op%. It lets users know that potentially "here be dragons".
Re:Zig, the Small Language
by WalterBright on Wednesday September 07, 2022 @01:47PM
(#32753760)
That has come up a few times. Frankly, %*% looks even worse. Using Unicode sounds like a good idea, until one discovers that the source code is not parseable without semantic analysis.
But I wound up being convinced that on balance it was a good thing. But I was able to inculcate a culture that operator overloading should be restricted to the creation of user arithmetic types.
Not allowing the overloading of unary *, &, and dot also help discourage non-arithmetic overloading.