[rust-dev] std::num::pow() is inadequate / language concepts
slabode at aim.com
Sat Jul 26 10:56:04 PDT 2014
On 07/26/2014 12:56 PM, Patrick Walton wrote:
> Well, part of the problem here is that people are going to want to write
> generic functions that take addable values. If we start making `+` and
> friends overloadable/ad-hoc, then people are going to be surprised when
> they can't pass (say) bignums to functions that want addable things.
The current Rust doesn't allow a complete lack of surprise. Either you
will be surprised by the traits not being supported by every numeric
type, or you will be surprised by the terrible performance of most types
that implement Op<T, T>. The core issue is that 'addable' (and other
concepts/functions) cannot be expressed efficiently for all types in
some unified way.
More information about the Rust-dev