3 ms·
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 c
by pie_flavor 5mo 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.
- scubbo 5mo ago> 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.
- deathanatos 5mo ago> 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.
- saghm 5mo agoI'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.
- j16sdiz 5mo agoNo. I have look it up years ago, and I don't remember all combination of `=` vs `^` vs `~` across all languages and package managers
- alexanderchr 5mo agoTo make it even more interesting, in npm ^ works differently depending on what version you are on
- saghm 5mo agoFor 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.
- drcongo 5mo agoAlso 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"`.
- DangitBobby 5mo agoI've looked up the ^ and ~ syntax differences probably half a dozen times. They are arbitrary and un-intuitive.