There are cases in math or physics when the granularity is needed. For example, when implementing vectors (in the math or physics sense), it doesn't make sense to define a division operator, and what you mean by "multiplication" depends on if you mean dot product, cross product, or whatever. It'd be simplest to define addition and subtraction but require multiplication to use an explicit method call.
Is it possible to define a Num interface which is the superset of interfaces for addition and multiplication, and use that when necessary? - Alex Reinhart On Jan 25, 2012, at 2:18 PM, Marijn Haverbeke wrote: >> What about an add interface? > > That works, but doesn't provide the conceptual simplicity of a number > interface, and if you want to write a generic over any numeric type, > it could end up taking a <T: add, mult, sub, div> type parameter. > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev