overloading operators for I/O

Manfred Nowak svv1999 at hotmail.com
Wed Feb 14 13:49:27 PST 2007


Walter Bright wrote
> You see some code:
> 
>      x = a + b;
> 
> and what do you think? I think "add a and b, assign the result to
> x"

What one thinks depends on the education.

As soon as one has exposed ones thinking to abstract algebras, the 
mathematical structures of groups, rings and fields, etc., one looses 
the binding of addition to "+". It comes back, when one is assured, 
that the operands are indeed the usual numbers.

"x = a + b;" may then very well mean: start rocket squads from 
locations a and b, combine them("+") to an attack formation and let 
them attack("=") location x.

Please be aware that also D currently breaks your thinking:
  
  x = b;

can currently assign a value to b. This contradicts your statement 
above.

-manfred 



More information about the Digitalmars-d mailing list