News for hackers. Stuff that matters.
Re:Rust's 2018 roadmap by cesarb on Monday March 12, 2018 @01:33PM (#16569759)
Could this be used to add an "Ord::clamp" or similar to the stdlib such that it's invisible (and thus wouldn't cause any conflict) to crates with an older "edition"?
Re:Rust's 2018 roadmap by Manishearth on Monday March 12, 2018 @02:24PM (#16570220)
I think for such things it's preferable to just have a `clamp` method as a static method, i.e. you call it with `Ord::clamp(foo, bar)` instead of `foo.clamp(bar)`.

But yes, it could.

Generally the trend seems to be to still try to avoid having actual breakages in the editions unless we _have_ to, and this seems like one of those cases where we don't.

That said, adding Ord::clamp doesn't technically count as a breakage for Rust, Rust's stability guarantee does not include "we added a method to this trait/type and now you have to disambiguate via UFCS" or "we added a thing to this module and now you have to alias your import" because it's not really possible to have that stability guarantee and continue to evolve the stdlib.

That said, given that Ord is in the prelude, the bar for adding stuff to that is much higher. And Rust also cares about the impact of not-technically-breaking changes like these, so we definitely wouldn't just add it as a method.

Re:Rust's 2018 roadmap by aturon on Monday March 12, 2018 @01:38PM (#16569811)
Yes, it could! There aren't plans to do so yet, but it'd be worth spinning up a thread on internals about this.