logoalt Hacker News

umanwizardyesterday at 6:40 PM2 repliesview on HN

FWIW, the GP comment's claim that you're lucky if you can compile 2-year-old code is exaggerated, but so is yours. Rust does not offer "strong stability guarantees". Adding a new method to a standard type or trait can break method inference, and the Rust standard library does that all the time.

In C or C++, this isn't supposed to happen: a conformant implementation claiming to support e.g. C++17 would use ifdefs to gate off new C++20 library functions when compiling in C++17 mode.


Replies

throwaway27448yesterday at 7:32 PM

> and the Rust standard library does that all the time.

I don't doubt this is true, but do you have an example? I think I haven't run into a build breaking like this in std in like maybe seven/eight years. In my experience breaking changes/experimental apis are typically ensconced in features or gated by editions.

Granted, it'd be nice to be able to enforce abi stability at the crate level, but managing that is its own can of worms.

I did find that the breakage rfc allows for breaking inference, which tbh seems quite reasonable... inference is opt-in.

show 1 reply
ChadNauseamyesterday at 6:56 PM

Adding a new method can change the behavior of C++ code as well due to templates. Does the standard library never add new methods because of that?

show 2 replies