logoalt Hacker News

pie_flavortoday at 1:52 AM5 repliesview on HN

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.


Replies

scubbotoday at 1:58 AM

> 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.

show 1 reply
saghmtoday at 5:10 AM

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.

j16sdiztoday at 4:49 AM

No.

I have look it up years ago, and I don't remember all combination of `=` vs `^` vs `~` across all languages and package managers

DangitBobbytoday at 1:52 PM

I've looked up the ^ and ~ syntax differences probably half a dozen times. They are arbitrary and un-intuitive.

drcongotoday at 9:39 AM

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"`.