Well, Haskell has custom operators with priority set and left-right binding. That way it can work. But then, Haskell has a cutting edge and is barely readable as it is, although it is mostly used by some pretty smart people. (Haskell scares away all newbies, I think ..)
For C ++, I think there are:
- problems with analysis (consider the error
std::vector<std::list<int>> , where >> was parsed as a right-shift operator). The C ++ syntax is pretty complicated as it is. - feedback problems (introducing new operators that are combinations of old ones, for example!) can cause problems)
- problems with clarity (people do a rather strange thing with ordinary operators, making the program’s behavior difficult enough for the divine as it is.)
The latter is a robber, IMO.
However, nothing prevents you from writing C ++ - a preprocessor / parser that replaces your own operators with real function calls, and then uses the regular C ++ compiler (for example, like C ++ was built in C earlier). There would be a neat experiment if you kept your sanity long enough for delivery .; -)
source share