Ary Borenszweig wrote: > > What I'd like the compiler to do, if you don't define property+=, is to > transform this: > > 1. foo.property += 2; > > into this: > > 2. foo.property = foo.property + 2; >
Be careful. It's actually better to transform it into auto t = foo.property; t += 2; foo.property = t; The reason is because typeof(t) may have opAddAssign defined, but no definition for opAdd or opAdd_r. Other than that, I'm totally with you.
