Hacker News new | past | comments | ask | show | jobs | submit login

> it has unit conversion built in, so 3km ÷ 26m will be evaluated to 4.62km/h, and also you can ask for m/s

I’d expect 3km ÷ 26m to evaluate to roughly 115.4 (no unit). I hope it wouldn’t try to be too clever about whether “m” means metres or minutes, because such cleverness invariably goes wrong. Change it to “26min” or “26 minutes” or some such thing, please?




Thank you for spotting this. I fixed it to '26min'. Yes, there should be 1:1 mapping from suffix to unit and back.


same with h which can either mean hour or the planck constant.

units(1) does this right where one symbol corresponds to one unit only


Mmm, true. I started using units(1) quite recently, and “h” being the Planck constant rather than hours keeps on tripping me up. The built-in abbreviation “kph” for km/hr isn’t comfortable either. (mile/hr may be commonly abbreviated as “mph”, but km/hr is conventionally “km/h”). Ah hah! There, just created ~/.units containing `h hr`, now this will bother me no more (since I’m unlikely to ever want to use the Planck constant). Pity it doesn’t use XDG paths (which would probably land the file at ~/.config/units), though you can define the environment variable MYUNITSFILE.


> Pity it doesn’t use XDG paths

Yes!! Can we all just agree to make that illegal? If a developer writes an app that automatically defaults to having configs right in the home dir or if they don't separate their cache from their persistent data, they go to jail for a week to think about what they did.

All joking aside, it really is a shame so many things don't stick to the standard. The ability to just copy .config to another machine and have it be pretty much a carbon copy of the original would be really useful. I guess I should just finally switch ti Nix, huh?


> If a developer writes an app that automatically defaults to having configs right in the home dir

To be fair, I think `units` and `~/.units` predate XDG paths by a couple of decades at least (`units` was from Bell Labs, XDG paths are from somewhere around 2005-2010 as best I can find.)


Oh yeah, definitely, and so do most other programs that don't respect the standard (VS Code being the biggest exception). Still, wouldn't hurt to update things a little, although in the grander "backwards compatibility vs modernisation" debate, this is still a small and insignificant issue.


I don't think anything I use uses those paths, I'd never even heard of them. Vscode, conan, cmake, gdb, perf, docker, vim, git, any of those use it?


Git does (though it will use the old-style dotfile if one is present). All of modern GNOME and I think KDE does. More generally see <https://wiki.archlinux.org/title/XDG_Base_Directory>.


> same with h which can either mean hour or the planck constant.

To be fair, I think the probability of a normal person using 'h' to mean the Planck constant is low enough that "2h" meaning "2 hours" is going to be right ~100% of the time.

(Although, actually, having just learnt that `units` comes from Bell Labs, they might well have been using 'h' for Planck constant more than for hours.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: