Ie. give the class the option of still creating a copy if it wishes.
I don't think that'd be a good idea since it'd get difficult to know if the operator += is destructive (with side-effects) or not. In that case it's better to leave it as it is, i.e. consider it to be nothing but an optimization and not make it part of interfaces.
Still, there's clearly a need for an lfun-like interface to make explicit destructive calls. It probably can't be operator-like though, since I don't think we can figure out a whole new set of destructive operators that fits well enough. Not that I wouldn't give it a try.
Also, this is how `+= works now.
Actually not right now in 7.5. The assignment is optimized away there. Could be considered a bug, but otoh there's never any need to define a `+= at all if it can't be destructive.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-05 03:19: Subject: Iterator interface
Not if a+=b; is compiled to a=a->`+=(b); Ie. give the class the option of still creating a copy if it wishes. (The norm would be to return this_object() from `+= of course.) Also, this is how `+= works now.
/ Fredrik (Naranek) Hubinette (Real Build Master)