Hacker News new | ask | show | jobs
by everforward 244 days ago
Libraries make sense when the tool is limited by the text-only Unix philosophy. E.g. highly concurrent or just high performance HTTP requests will be limited by the overhead of spawning `curl` processes, parsing responses, and having to re-allocate memory since you can't just take over the memory curl already allocated. Also when the user is unlikely to care which one you use (I don't care much what HTTP library a given binary uses).

Pagers are practically the worst thing to make this argument about, because they mesh perfectly with the strings-only nature of Unix. They take a string and allow the user to navigate through it. They only need to be fast at human-recognizable speeds, there's little reason for them to be highly concurrent, and there's a lot of value in allowing the user to choose which pager they want they to use.

More broadly, there's also value in composable tools because users can use the one they're familiar with. I can learn how jq works and use it with anything that outputs JSON, rather than having to learn the syntax of 18 different libraries various app developers have chosen for querying JSON. I can pipe whatever I want into 'more' instead of having to learn the keybinds for each of the 5 popular paging libraries.

It's not perfect, but I do think it's better than the embedded alternative for a lot of things.