On Wed, 14 Oct 2009 18:39:27 +0400, Robert Jacques <[email protected]>
wrote:
On Wed, 14 Oct 2009 10:31:06 -0400, Andrei Alexandrescu
<[email protected]> wrote:
Don wrote:
Well timed. I just wrote this operator overloading proposal, part 1.
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP7
I concentrated on getting the use cases established.
I'm not sure multiplication is generally commutative (e.g. in linear
algebra it isn't). So why should a * x be interchangeable with x * a?
Also, the much-discussed identity:
x @= y <--> x = x @ y
is difficult to enforce statically in practice. I think some types
would want to define both to achieve good efficiency. It would be hard
for the compiler to render one unnecessary or to prove that the two are
equivalent.
Andrei
When a is a scaler, a * x <=> x * a generally holds. It's only when
something isn't a scaler, i.e. x1 * x2 != x2 * x1, that community(?)
doesn't hold.
It's commutativity (http://en.wikipedia.org/wiki/Commutativity)