On 29.04.2011 18:13, Steven Schveighoffer wrote: > Static opCall is possible, but I wasn't aware of the other operator overloads > being possible.
I wasn't too - it is not mentioned anywhere, just tried it. > Note that opAssign is a valid symbol name, so it can be used in places even > where it doesn't overload assignment, such as a static or global function. > It just won't map to any operator usage. Well, the fact is - it maps. If I've static opAssign() defined, it is called when I assign something to an object. Even more fun - static opAdd() maps too, and - wow! - if it returns new object, i.e. construction like: X x; x = x + 3; then it will allocate new instance of X, where: static typeof(this) opAdd(int i) { return new X(i); } I am impressed... :) /Alexander