Comment by pie_flavor
19 hours ago
And then you look it up once, and now you know what it means forever. By contrast, the former expression is much wider with more going on, and furthermore you can't skim past it being sure nothing funny is going on because it may or may not be a range compatible with the latter form.
> now you know what it means forever
Not, in fact, correct. Knowledge only cements itself in the brain when it's regularly referenced. Because `>=` and `<=` borrow well-established concepts well-established, they are both intuitive to people reading them for the first time, and easier to solidify or to re-infer for someone who's forgotten their meaning.
> Knowledge only cements itself in the brain when it's regularly referenced.
While true, this is a molehill, not a mountain, of a bar, like "coding once in a while". I'm doing mostly SRE work, and this syntax has no trouble sticking in my head, and I encounter it pretty regularly? (And heck, most of my work these days is in Python, so there I get the >=,< syntax and yearn for the ~mines~ caret, and I still recognize it?)
If you're actively developing a codebase, this definitely isn't going to be arcane trivia.
I'd argue that complaining about using combined "greater than" and "less than" operators instead of the caret is about the same size of molehill as complaining about the usage of it. Seeing either of them in dependencies at my job would be a pretty mundane event that I wouldn't bother trying to do anything about.
For what it's worth, even as someone who's known about the syntax for over a decade, I think there have already been two times this calendar year that I've mistakenly gotten the meanings of the caret and tilde operators on package versions mixed up and been corrected on it.
No.
I have look it up years ago, and I don't remember all combination of `=` vs `^` vs `~` across all languages and package managers
To make it even more interesting, in npm ^ works differently depending on what version you are on
I've looked up the ^ and ~ syntax differences probably half a dozen times. They are arbitrary and un-intuitive.
Also worth mentioning that a carat doesn't require quoting in your shell so you can type `uv add something^1.5` which is a hell of a lot easier to write than `uv add "something>=1.5,<2.0"`.