From: "austin (Austin Ziegler)" Date: 2021-12-02T15:28:31+00:00 Subject: [ruby-core:106395] [Ruby master Feature#18376] Version comparison API Issue #18376 has been updated by austin (Austin Ziegler). deivid (David Rodr��guez) wrote in #note-11: > > RubyGems could adopt this API and slowly phase out its own version. > > Thanks for bringing that up. The more I think about it, the more I dislike it. I don't think version comparison is common enough to be something builtin to core, let alone if it's only to satisfy the needs of a handful of default gems (only ffi has been mentioned so far). It feels to me that in order to save one line of code in ffi, I have to go through the trouble of slowly phasing out what's probably the most commonly used rubygems constant in the wild. Definitely not a fan :sweat_smile:. I have at least two libraries that I maintain using the `Gem::Version` API for feature enablement or back-port support. Some libraries that I have used for projects set `VERSION = Gem::Version.new('1.2.3')`; at least some of the gems that I have used in the past _also_ use the version API in the same way that I do. People reach for `Gem::Version` because it���s the most feature-complete readily available semver library for Ruby. As a comparison, Elixir _does_ provide a `Version` module as part of core. If we don���t want to add a `::Version` constant to core, then perhaps the _best_ thing to do would be for `Gem::Version` to be made available _separately_ from the rest of RubyGems, possibly importing it into core (this has the benefit of _not_ requiring an API change for anything that _uses_ it). Or maybe (and this is a bit of a bootstrap problem), `Gem::Version` could be packaged as its own gem for people to import separately if they need gem versioning. This isn���t a _frequent_ problem, but I disagree that it���s "not common enough". I have _no clue_ what would happen with the gems that I maintain (`mime-types` is perhaps the easiest version to test) if run with `--disable-gems`. I think that this is worth adding to core. ---------------------------------------- Feature #18376: Version comparison API https://bugs.ruby-lang.org/issues/18376#change-95033 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal ---------------------------------------- Is there a chance to have version comparison API? For example if `Gem::Version` was extracted into `::Version`. This idea was triggered by this PR [1] and [2], where the `Gem::Version` API is used for comparing Ruby versions. While RubyGems might be available everywhere, it does not look correct to introduce dependencies on RubyGems into libraries which could run without them just fine. [1]: https://github.com/mperham/connection_pool/pull/157 [2]: https://github.com/mperham/connection_pool/issues/158 -- https://bugs.ruby-lang.org/ Unsubscribe: