Hacker News new | ask | show | jobs
by satvikpendem 1003 days ago
Then what's the point of editions, if the crates are forward and backward compatible?
1 comments

The point is that crates written against different editions are forwards and backwards compatible, but how the crate is written isn't.

So Rust can make a "breaking" change in a new edition. This isn't actually breaking because you need to "opt-in" by updating to the new edition. This allows many "breaking" changes without actually breaking the ecosystem. Each crate can upgrade whenever they feel like it (possibly never) and they can make this decision independently of any other crates.

For example look at the breaking changes introduced in the 2021 edition: https://doc.rust-lang.org/edition-guide/rust-2021/index.html. Each item on the left menu is a breaking change that was able to be shipped due to the edition system.

You are right that the edition system does create limits for what can be changed. However this is because doing so would have downsides. Notably if older editions couldn't depend on newer editions I may need to migrate my crate to a new edition in order to update a dependency to get a security fix. Edition updates are typically quite easy but it was still a conscious decision that they aren't ever required, unless you want to take advantage of the new features added in that edition.

Sounds like what Python 2 to 3 should have been.
where do you think they learned it from? python 3 (like python's package management mess) is wonderful for PL because it was a very public materclass in decisions that seem reasonable, but work really badly in practice.