Am 01.03.2012 03:40, schrieb Jonathan M Davis:
On Wednesday, February 29, 2012 21:23:54 bearophile wrote:
Jonathan M Davis:
put is a function on output ranges, and Appender is an output range.

Also, given that it doesn't define ~ (and it wouldn't really make sense
for it to), it would be very weird IMHO to define ~=.

I don't understand why that's weird.
In Java you can't overload an append operator, so using a method is right.
But for me it's weird that Appender doesn't use the D operator to _append_.
I sometimes use "add" instead of "put" by mistake, forgetting the right
method name, because I find it quite unnatural. If Appender needs a put,
then I suggest to give it both "put" method and "~=" operator.

Would you define += without defining +? Or *= without defining *? It strikes me
as a misuse of operator overloading if you have an opOpAssign without its
corresponding opBinary.

- Jonathan M Davis

Consider matrix * vector and matrix *= vector for an opposite example.

Reply via email to