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

Allow ruby pessimistic operator (~>) as well as tilde (~) #2476

Closed
patcon opened this issue Dec 3, 2013 · 2 comments
Closed

Allow ruby pessimistic operator (~>) as well as tilde (~) #2476

patcon opened this issue Dec 3, 2013 · 2 comments

Comments

@patcon
Copy link

patcon commented Dec 3, 2013

It would be great if ~ and ~> were parsed as the same operator in composer. This would make it simpler for rubyists to walk in composer's world, without sacrificing anything for those already using composer.

Came across the below issue, which makes me think I'm understanding our current behaviour correctly, and that the suggestion would make sense:
#1679

Here's an external explanation of the pessimistic operator, proving that they're the same thing in ruby-land.
http://robots.thoughtbot.com/rubys-pessimistic-operator

@patcon
Copy link
Author

patcon commented Dec 3, 2013

https://npmjs.org/doc/misc/semver.html

Hm. Seems npm's semver operator ~ works the same way as ruby's. Not sure why we don't all make our operators cross-compatible. I guess that's my suggestion then :)

@Seldaek
Copy link
Member

Seldaek commented Dec 4, 2013

First of all we can't really change this without breaking BC. That said, I don't think it needs changing. We do what bundler's ~> does, and we are close to what npm's ~ does, except where it disagrees with bundler.

constraint composer bundler npm summary
~1.2.3 >=1.2.3 && < 1.3.0 >=1.2.3 && < 1.3.0 >= 1.2.3 && < 1.3.0 all equal
~1.2 >=1.2.0 && < 2.0 >=1.2.0 && < 2.0 >=1.2.0 && < 1.3.0 npm differs

As I pointed out in that other issue, npm's ~1.2 behavior is equivalent to 1.2.* so I don't think it's particularly superior.

As for supporting ~ or ~>, I guess we could "support it" with a warning just so people mistyping it get nudged in the right direction. I don't think having two operators doing the same is a good thing.

@Seldaek Seldaek closed this as completed in 80499bb Dec 6, 2013
hrach referenced this issue in nette/nette May 12, 2014
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

2 participants