Suppose you have some general algorithm working on all the numeric types. And suppose there's an optimized version of it particularly for 32-bit integers, that works say 20% faster. It is a substantial optimization, but do you believe that every programmer using it should know whether it is applied?
On Thu, May 29, 2014 at 4:48 PM, comex <[email protected]> wrote: > On Thu, May 29, 2014 at 7:01 PM, Tommi <[email protected]> wrote: >> The lack of function overloading forces us to have two differently named >> functions, say `foo_a` and `foo_b`, and the programmer has to keep in mind >> that if he wants the optimized algorithm, then he needs to call `foo_b` >> (instead of `foo_a`) if his argument implements `B`. > > I would consider this usually an upside, because this way the > programmer knows whether the fast or slow version is being used, and > that calling the slow version may be a hazard to be improved by > refactoring the code to implement B. It may occasionally be a > downside. > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
