-
Notifications
You must be signed in to change notification settings - Fork 120
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
Operator Overloading #85
Comments
I would have loved to do that at the time. I don't think Rust had I would definitely love to see the impact of that and would be happy to merge it, though I would rather not import |
Great, I'll give it a try, probably some time next week. Thank you for the warnings, @burdges! 😄 My plan for now is just to only add the operators whose implementations are already there: If there's an |
I made a start with Could you please have a look whether you'd be okay with that kind of implementation? Then I'll do the same for |
One good test is to see how it impacts downstream libraries and benchmarks. I'll do this when I get a chance. |
I am very busy but I submitted a partial review. |
Unfortunately it will be backwards-incompatible, since the existing method I'm hoping that performance shouldn't change: The implementations are identical and I carried over all the
I can't see any comments (and didn't open a PR for this). |
Yeah, I don't know where my review was or what I was even referring to! |
Would it make sense to overload the arithmetic operators (
std::ops
) for everything that has anadd
,add_assign
,mul
ormul_assign
method? I would love being able to writex += y;
instead ofx.add_assign(y)
, but I know that there are arguments against it, too. It certainly would make some heavy computation "feel" more lightweight than it is.What's your opinion on this? If you are fine with it, I'd be happy to try and make e.g.
Field: AddAssign + MulAssign + SubAssign + Neg
, andCurveAffine: Mul + Neg
.The text was updated successfully, but these errors were encountered: