rust-num / num-rational

Generic Rational numbers for Rust
Apache License 2.0
144 stars 51 forks source link

Consistency of macros use #50

Open maxbla opened 5 years ago

maxbla commented 5 years ago

Add, Sub and Rem are implemented with macros. They're harder to read because of it, but their implementations are all the same except one line. Separately, AddAssign, SubAssign and RemAssign are implemented without macros, and their implementations are all the same except one line.

We should consider going full macro or going full no-macro for all of these.

cuviper commented 5 years ago

I think the macros are definitely good for forwarding all the by-ref/value stuff, but I think it would be fine to separate the actual Add/Sub/Rem implementations.