-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement OpAssign for Complex #186
Conversation
Add tests by expanding the current a + b tests to include a += b, and so on.
OpAssign is possibly a big break inducer higher up in num as well. You could consider adding an extra trait like this: That alone didn't seem like a great motivation to introduce "NumOpAssign." |
Instead of a manual feature, perhaps we could use Implementing these by value is acceptable to me. Most of the time I expect The trait requirements are the tricky question, because we can never expand them without a breaking change. For instance, in I also think it will be confusing to users if opassign is allowed with a complex RHS, but not a real. e.g. if |
I would love to enable these by default with rustc-version. Not sure if it's proportionate to compile that crate too and call rustc another time. I think it's relatively lightweight, but still. It's unfortunate to have to choose in that manner between Add and AddAssign, but I'll happily use AddAssign when it's possible. |
Hmm, sorry this lingered. We really should do a server bump already and be done with it... Maybe I should open a |
I was just closing all kinds of PRs in different projects that had been inactive. In general I think |
We need to figure something out, yes. The reason I'm so conservative with it is that Even now We should evolve, but I want to minimize the actual churn. I hope that in most cases, folks will be able to just bump their dependency and carry on. |
Use a crate feature ("opassign")
Design choice: Use by-value forms of OpAssign and use Clone to forward the reference arguments. That matches what the other traits do (for example Add).
Design choice: The complex += complex operation needs Add, not just AddAssign. The complex += real operation can use just AddAssign. You could just use
Add
for both, not sure which way is preferable.