Reconsider C-STABLE guideline #258
kvark
started this conversation in
API Guidelines
Replies: 2 comments 3 replies
-
I think the idea of the guideline is correct. It probably just needs some rephrasing, although, pinpointing precisely what to say seems a little difficult. The gist of it is that your public dependencies should probably be at least as "stable"/"mature"/"rate of breaking changes" as your own crate. Or something to that effect. I think the current wording is just using what folks tend to treat 1.0 as: a point at which a crate's rate of change of breaking API changes "slows." Notice that I did not reference the semver spec in my response. I don't think it's particularly relevant to this guideline. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Link: https://rust-lang.github.io/api-guidelines/necessities.html#public-dependencies-of-a-stable-crate-are-stable-c-stable
I believe this guideline is inconsistent with reality and based on flawed reasoning.
Where does the definition of "stable" come from? Doesn't appear to be from SemVer spec, which just says:
It doesn't say that "stable" is ">1.0.0", it only says that "stable" should probably lead to "1.0.0", which is a much weaker statement. I.e. the original spec describes "stable" as an abstract term, and only provides recommendation based on it.
More importantly, the original recommendation is based on the fact that it provides essentially no versioning guarantees before 1.0:
The difference with Rust ecosystem is drastic and critical: our modified SemVer does provide versioning before 1.0. So pre-1.0 dependencies don't break any more often than post 1.0, technically speaking. Therefore, I argue that the original recommendation about 1.0 doesn't make sense for Rust ecosystem.
To support my argument, I just tried to publish a project depending on pre-1.0 library. And Cargo is happy to do this without any notes or warnings about pre-1.0 dependencies:
If "crate cannot be stable" is indeed the guideline you want, then I'd expect cargo to check it and nudge people towards following it. It could simply fail in this case while requiring "--allow-unstable" option to proceed, similar to all other red flags that cargo may see.
Beta Was this translation helpful? Give feedback.
All reactions