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

meaning of ~ is inconsistent #31

Closed
dominictarr opened this issue May 30, 2013 · 6 comments
Closed

meaning of ~ is inconsistent #31

dominictarr opened this issue May 30, 2013 · 6 comments

Comments

@dominictarr
Copy link

when specifying a patch range, ~ means greater than of equal to the next least significant value, but before but don't go into the next range.

i.e. ~1.2.3 means, I want patches to this module, but not if it means taking a new feature.
contrast that with 1.2.3 which means only use this exact version.

indeed,

assert.deepEqual(semver.toComparators('~1.2.3'), semver.toComparators('1.2.3')) throws, as it should.

however,

you can also say '~1.2' which, if I was extending the meaning of ~ from before id expect it to give me 1.2.3, 1.3.4, but not 2.0.0.

however,

deepEqual(toComparators('~2.16'), toComparators('2.16')) does not throw!

turns out, ~ on means anything when you have a full semver and nothing when you have only one or two values.

This behaviour is documented
(although, it could be documented more clearly by saying that in ~x.y '~' is ignored.)

Would you take a patch to make ~ behave consistently?

@vierbergenlars
Copy link

@dominictarr In the second deep equal, you are comparing two identical toComparators calls. Sure it does not throw.

@dominictarr
Copy link
Author

@vierbergenlars sorry, corrected.

@isaacs
Copy link
Contributor

isaacs commented Jun 12, 2013

@dominictarr The more I think about this, the more I think you're right.

I'd like to make a proper specification for version ranges, and then comply with it.

@isaacs
Copy link
Contributor

isaacs commented Jun 17, 2013

Yeah, I don't think this is a good idea. I did some investigation recently into how versions and ranges are used on the registry. Changing this is more disruptive than not changing it.

@isaacs isaacs closed this as completed Jun 17, 2013
@dominictarr
Copy link
Author

Fair enough. I'm now using >=x.y <x+1 when I want this kind of thing.

@isaacs
Copy link
Contributor

isaacs commented Jun 18, 2013

Also, for better or worse, it IS identical to the meaning of ~> in rubygems.

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

No branches or pull requests

3 participants