Don wrote:
Walter Bright wrote:
My problem with operator overloading stemmed from C++'s endorsement of
using >> and << for stream operations.
I saw someone who wrote a database library, and used << and >> for
stream operations. Then he needed a second form of stream operations, so
he overloaded > and <.
db < x < y; // stores x and y in the database
(db < x) < 7; // stores x and 7 in the database
db < (x < 7); // stores a bool in the database.
if (db > x) { zzz; } // gets x from the database, then does zzz.
What fun!
Adding in < and > for templates just makes it all worth while!