Hacker News new | ask | show | jobs
by WalterBright 5074 days ago
I think the poster child for operator overloading abuse is iostreams overloading << and >>.

However, operator overloading is very much needed for when creating user defined types that have arithmetic properties, such as bigint, or matrix.

As for the confusion about whether + means "add" or "concatenate", that is unresolvable. The D programming language deals with it by introducing the ~ binary operator to mean "concatenate". No more problems.

Although in D one can overload operators to mean any crazy thing one wants to, the consensus in the community is to eschew non-arithmetic use in the same manner that the C community has condemned:

    #define BEGIN {
    #define END }