Why Java Doesn't Need Operator Overloading (and Very Few Languages Do, Really)

Daniel Keep daniel.keep.lists at gmail.com
Thu Apr 16 05:33:37 PDT 2009



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!
> 

db<x> y; // copy x to y

:D

  -- Daniel



More information about the Digitalmars-d mailing list