-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equality with build metadata ignored? #108
Comments
(currently this panics) |
(feel free to close if this is expected) |
related to #107 |
I think this should be closed, as mentioned in #107 (comment):
So those two versions are equivalent. It's more obvious if you use more obviously-looking build metadata like: let a = semver::Version::parse("1.0.1+built-at-1205").unwrap();
let b = semver::Version::parse("1.0.1+built-at-1210").unwrap();
assert!(a != b); |
As I mentioned in #107 (comment), I think this is a misreading of the spec. Having the same precedence does not mean they are equal. Or to put it more specifically, I think it should be ignored in a
|
In the docs it says:
|
Nothing I said conflicts with that |
I don't think you can or should have such an implementation of "Can" because I think you could interpret the semver spec as saying that you must be allowed to query version precedence. And "should" because I think it would be throwing the baby out with the bathwater to not be able to compare if a version is < or > another, just so that you can have build-metadata sensitive equality. |
The docs are specific about what this means:
I have not said anything which disagrees with that (nor does any of it as written even apply if you're not implementing |
Ah, I think I understand what you're saying now. I'm saying that |
Ah, I had missed those important details in I would assume that Has anyone in the ecosystem encoded these laws so we can just test for our difference in interpretation (the trait laws, not a semver thing)? Secondly, I'm not too familiar with Ord vs PartialOrd, what is lost by implementing only the latter? |
The ability to be used anywhere that requires total ordering, such as being a key in a EDIT: It appears I was mistaken, |
This is fixed in 1.0.0. fn main() {
let a = semver::Version::parse("1.0.1+1.7.3").unwrap();
let b = semver::Version::parse("1.0.1+1.7.5").unwrap();
println!("{}", a == b);
} false |
I may be misunderstanding what pre is used for, but I'd expect this program to pass?
The text was updated successfully, but these errors were encountered: