4 ms·
It's really language version pinning for source code. Rust uses version pinning heavily. This gradually builds up a legacy code problem, as old versions never
by Animats 9y ago
It's really language version pinning for source code.
Rust uses version pinning heavily. This gradually builds up a legacy code problem, as old versions never really go away. A recent article on HN pointed to some bloated non-Rust phone app which shipped with four different versions of some libraries.
How does this work when crates with different epochs are mixed? The business with "core Rust" suggests that all code must be compiled with the same core compiler, because the run-time model might change, but some crates may have different epochs.
- steveklabnik 9y ago> How does this work when crates with different epochs are mixed? It Just Works. (The discussion contains some stuff about macros, which may be a bit more complex, but that's the core concept anyway.) > the run-time model might change Rust has no more runtime than C. It's in fact in the opposite; the only kinds of changes that can be made in epochs are basically to the parser, everything below that has to stay the same. This is for both technical debt reasons as well as for "mental debt" reasons; the core way that Rust works cannot change.
- GolDDranks 9y agoI think he means run-time semantics. But anyway, the promise of stability means that the semantics can't be changed in a breaking way. So having epochs is no free pass to do arbitrary kind of breaking changes, and the Rust people are well aware of that.
- dbaupp 9y ago> How does this work when crates with different epochs are mixed? The summary addresses this: > Each crate specifies the epoch it fits within (a bit like "C++11" or "C++14"), and the compiler can cope with multiple epochs being used throughout a dependency graph. Thus we still guarantee that your code will keep compiling on the latest stable release (modulo the usual caveats), That is, a single compiler can handle multiple epochs, meaning that anything/everything can change, but it has to change in ways that keeps compatibility with the behaviour of the old epochs. Using crates compiled with different compiler versions (rather than language versions within a single compiler) is ABI stability, which is a whole different level beyond source/"API" stability.
- tatterdemalion 9y agoOther people have addressed the question about epochs, but I'd also note that we do work to mitigate the code bloat issues of multiple versions of libraries. cargo is designed to unify all dependencies on a library within each major version to a single instance (that is, you'll never build serde-1.0.0 and serde-1.1.0 together, but you may build serde-1.0.0 and serde-2.0.0).
- Manishearth 9y ago> you'll never build serde-1.0.0 and serde-1.1.0 together nit: unless you explicitly ask for this by an `=1.0.0` version dep. which is rare, but can be pretty useful in edge cases.
- tatterdemalion 9y agoThat's not correct. cargo will fail to resolve your dependencies if that happens. For example (cargo_metadata 0.2.1 depends on serde ^1.0.2): [dependencies] serde = "=1.0.0" cargo_metadata = "0.2.1" Attempting to cargo fetch will result in this error message: error: failed to select a version for `serde` (required by `cargo_metadata`): all possible versions conflict with previously selected versions of `serde` This is an intentional design decision in cargo that isn't well known.