[rust-dev] std::num::pow() is inadequate / language concepts

Patrick Walton pwalton at mozilla.com
Thu Jul 24 16:27:15 PDT 2014

On 7/24/14 3:46 PM, Gregor Cramer wrote:
> Probably in this case it might be a solution to move pow() into a trait, but
> I'm speaking about a general problem. Rust 1.0 will be released, and someone
> is developing a new module for version 1.1. But some of the functions in 1.0
> are inadequate for the new module, how to solve this without changing 
> the API

If the signature is wrong and we mistakenly freeze it, we can just introduce a new function with a different name.

> in 1.1? I think that function overloading may help in some cases, but the
> problem with inappropriate footprints remains. In my opinion this
> thing with the footprints (reference or not if the real type is unknown -
> that's why the concept with 'const' in C++ exists) is a conceptual design
> issue, but probably I do not yet fully understand Rust.

Overloading only helps some simple cases, and adds more complexity than it's worth (IMO).

The problem with C++ isn't that it doesn't have enough features. Rust is deliberately omitting some features from C++ that don't pull their weight. Overloading is one of them.


More information about the Rust-dev mailing list