Thread overview |
---|
June 01, 2013 The copious @= operator | ||||
---|---|---|---|---|
| ||||
This @= is the .dup protocol @= would copy, while the = is most usually a reference assign when that is possible. If you have a regular method of clone which is a protocol for most all things who agree to use it, then = for assign by reference is more fair |
June 01, 2013 Re: The copious @= operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrzlganeE | This idea is pretty awful, because it works good for: a @= b; But it doesn't cover the cases where .dup is far more general: T[] l = [ a.dup, b.dup, c ]; Modified by a stretch to macro cloning: T[] l @= [ a, b, c ]; // all 3 of them clone. nuts for every reason you could come up with. Yet, which "should" only parse properly to: T[] l = [ a, b, c ].dup; // even if expression-scope-auto-cloning was not crazy |
June 01, 2013 Re: The copious @= operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrzlganeE | I actually like the ability to clone all the elements of the slice being made. If there's merit to this idea, or if it's terrible, I'd trust Walter and Andrei to know the real answer considering the implications. Hence why I did not make a proposal for this operator. |
Copyright © 1999-2021 by the D Language Foundation