On 3/15/2015 1:45 AM, Jonathan M Davis via Digitalmars-d wrote:
On Saturday, March 14, 2015 15:35:24 Ali Çehreli via Digitalmars-d wrote:
C++ needs a rule like D's, which will never be there.
Yep. By making it so that you only overload a single operator for both
versions of increment, we avoid the whole problem in D, similar to how
having opCmp avoids bugs related to having to define each comparison
operator individually as is the case in C++.
There's another reason why D specifies some arithmetic identities for
overloading arithmetic operators. It's to make abominations like C++ iostreams
that overload operators for non-arithmetic tasks much harder to do.