-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add caret requirements (^x.y.z) support to Version module #11448
Conversation
- Implemented caret requirements support - Add unit tests regarding carot requirements feature Caret requirements (^x.y.z) are supported many languages like Rust and Node.js. It has the advantage of being able to designate semver compatible version specifications in more detail conveniently. There is no harm in supporting it, so I hereby added the implementation. References: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements https://docs.npmjs.com/cli/v6/using-npm/semver#caret-ranges-123-025-004 npm/npm#4587 CC @guersam Co-authored-by: Jisoo Park <jisoo.park@doomoolmori.com>
Hi @simnalamburt, thank you for the PR! You can achieve similar behaviour by doing this: However, I prefer the Elixir behaviour here: if you need to specify a specific patch version of a package, then you should explicitly opt-in into depending on all of its minor versions too. Therefore, we need to answer if this difference is enough to introduce a new construct? Because, while there is no harm per se, it is a new construct that developers need to learn and understand when learning the language. Plus new code to maintain that will impact Elixir and likely all of Hex.pm users. For those reasons, I don't believe we should go ahead with this. There is a cost in API surface and I am not sure the extra properties it brings are desired either. In any case, thanks once again for the PR! ❤️ |
I think many Elixir packages use semantic version management customarily. This feature will prevent many libraries from being unnecessarily tied to past versions and will be very convenient for semver users. And since It is already a function supported by many package managers, so I don't think the learning cost will be too high. It is true that code maintenance costs would be increased, but please also note that |
Can you please start a discussion in the Elixir mailing list then? We should get some more visibility into the discussion. :) Having both |
That would be better. Thanks! |
|
Actually I don't think there will be much confusion from my experience in other languages (almost all users prefered |
That is what |
@ericmj there is a very tiny difference. |
Right, I disagree with the point that that specific functionality is needed for SemVer. It is unlikely we would be adding support for When we resolve versions in Hex we convert Error messages are just one reason why it would be confusing, having multiple ways of doing the same thing is confusing in general and means that developers has to learn both operators and make a conscious choice between when to use which. Since I think this feature request is specifically for Hex (please correct me if I am wrong @simnalamburt) I don't think we should go ahead with adding it to Elixir when it won't be added to Hex. |
OK I won't push this PR further, since eric said this feature won't be added to Hex. I'm leaving this note just for the records: Many existing elixir users are already confused by odd behavior of hackney: (~80000k downloads) nebulex_redis_adapter: (~100k downloads) Due to this, many packages' dependencies are unnecessarily tied to past versions. To prevent this, many users are using two plug: (~70000k downloads) These problems can be solved with |
The examples you listed are not examples of where the package author is confused about how |
Implemented caret requirements support, and added unit tests regarding carot requirements feature.
Caret requirements (^x.y.z) are supported many languages like Rust Cargo, PHP composer, python poetry, and Node.js NPM. It has the advantage of being able to designate semver compatible version specifications in more detail conveniently. There is no harm in supporting it, so I hereby added the implementation.
CC @guersam
Co-authored-by: Jisoo Park jisoo.park@doomoolmori.com
Fun fact: I've wanted this feature since 2017-04-09.
References: