op=

Rainer Deyke rainerd at eldwood.com
Thu Jan 21 20:38:50 PST 2010


Ellery Newcomer wrote:
> according to the spec,
> 
> a op= b;
> 
> is semantically equivalent to
> 
> a = a op b;
> 
> but this doesn't seem to be strictly true.


It's untrue in several ways.  For example:

SomeReferenceType a, b;

a = a + b; // Creates new object.
b += c; // Modifies an object in place.

and of course:

a = a = c; // Dual assignment.
a == b; // Equality comparison.


-- 
Rainer Deyke - rainerd at eldwood.com


More information about the Digitalmars-d-learn mailing list