Skip to content
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 more Version / Range capabilities #5310

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

lizmat
Copy link
Contributor

@lizmat lizmat commented Jul 7, 2023

  • add support for ^v1.2.3 aka all versions upto/not including v1.2.3
  • add smart-matching to allow v1.1 ~~ v1.0 .. v1.2 to work

- add support for ^v1.2.3 aka all versions upto/not including v1.2.3
- add smart-matching to allow v1.1 ~~ v1.0 .. v1.2 to work
Copy link
Collaborator

@JJ JJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/core.c/Range.pm6 Outdated Show resolved Hide resolved
@lizmat lizmat marked this pull request as draft July 7, 2023 12:42
@ugexe
Copy link
Member

ugexe commented Jul 7, 2023

I think the ^ stuff is going to be confusing.

While raku versions aren't semver, users will often mistakeningly believe it to be the case. This is unfortunate because while it makes sense for e.g. ^1 to be anything less than 1 in raku, in semver it means $ver >= 1 && $ver < 2. I'm not sure what to do about this.

Using ^v1.0 (i.e. raku range of version) is not generally useful enough. When declaring dependencies we do not use the v, and thus one would expect to write Foo:ver<^1.0> (i.e. a raku version range), not Foo:ver<^v1.0>. For example:

$ raku -e 'say Version.new("v1.0")'
vv.1.0

In other words: Version.new(...) needs to be able to parse and understand this new mechanism similar to how it handles + and *. Users should be able to write Version.new("^1.0") (and probably v^1.0 as well).

@lizmat
Copy link
Contributor Author

lizmat commented Jul 7, 2023

@thoughtstream ping

@Leont
Copy link
Contributor

Leont commented Jul 10, 2023

This think this is useful to have, but versions and version ranges should be different classes because they're really different (and complementary) things.

@lizmat
Copy link
Contributor Author

lizmat commented Jul 10, 2023

versions and version ranges should be different classes because they're really different (and complementary) things.

Agree. But the only thing I can see happening atm, is to make Version objects that are implicit ranges (aka, with a *, - or +) a subclass of Version, as a VersionRangeclass.

@Leont
Copy link
Contributor

Leont commented Jul 10, 2023

Agree. But the only thing I can see happening atm, is to make Version objects that are implicit ranges (aka, with a *, - or +) a subclass of Version, as a VersionRangeclass.

Except the relation is really more the other way around: Any version is also usable as a version range, but version ranges usually aren't usable as a version (e.g. they can't sort/compare, which is essentially the whole purpose of versions).

They should be different classes, with a trivial VersionRange(Version) constructor/coercer

@lizmat
Copy link
Contributor Author

lizmat commented Jul 10, 2023

Well, then we get to Range with Version objects. And that's another can of worms, with iterable and non-iterable Ranges.

@Leont
Copy link
Contributor

Leont commented Jul 14, 2023

Well, then we get to Range with Version objects. And that's another can of worms, with iterable and non-iterable Ranges.

They're also awkward because then you'd need an infinite version value (for the maximum value). Or to represent exclusions. It needs a separate class really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants