On Fri, Aug 23, 2013 at 8:36 PM, Graydon Hoare <[email protected]> wrote:
> On 13-08-23 11:28 AM, Masklinn wrote:
>
> > For the record, I think augmented assignments are a terrible ideas and
> one of the worst features of python.
>
> Could you say more (perhaps more constructively)? I believe we have
> every intention to support these sorts of overloads longer-term; we
> removed the previous support only because it wasn't done terribly well.
>
> -Graydon
>
>
Not masklinn, but coming from C++ I have seen operator overloading gone
wrong.
The most trivial mistake is to have `+=` and `+` defined so that `a += 5`
has a different result than `a = a + 5`; the error can be subtle, and is
generally hard to catch because you expect it to be right (about the same
issue than `bool operator<(left, right) { return left.a < right.a && left.b
< right.b; }`).
If one wants to introduce assignment operators, then, it would be great if
this issue was taken care of. It might not be easy though. Especially
because of some peculiar issues, such as the fact that `+` can take a
constant on either side but `+=` requires a mutable on the left-hand side.
I hope you'll have great ideas.
-- Matthieu
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev