Hacker News new | ask | show | jobs
by MuffinFlavored 817 days ago
But in this post we're seeing this "mindset" trickle to the Rust ecosystem, for something as "complicated" as command-line argument parsing
3 comments

Clap is a really fantastic command-line argument parser, especially using the "derive macro" they now include. Once you start dealing with git-like subcommands, and other complex cases, it Just Works. You get help, short and long options, defaults, repeated arguments, deserialization to custom types, etc. Essentially everything is accessible with a couple of lines of code.

Life's too short to build all of this each time. I'm perfectly happy to ship 2-5 MB zip archives, which is where a lot of my more complicated Rust tools wind up.

(maintainer of clap)

In this situation, if they were truly concerned about clap, I think they should have gone down to lexopt (https://docs.rs/lexopt/) rather than roll their own

If every odd utility is several megabytes, good luck fitting an OS in a meager eMMC.
Command-line parsing with good errors and help really is quite complicated. Clap doesn't have that many unnecessary features.
I believe it actually has a lot more to do with the tools than some "mindset" in the community. You don't see this sort of thing in C++ really, because deep trees of transitive dependencies are painful. While Rust... has pretty much the exact same package management style as Node, so it doesn't surprise me that it has similar results.
Worth pointing out that Java also has automatic transitive-dep package mgmt courtesy Maven & friends, or at least has had since the mid 00xs. And while it does have some amount of dependency explosion it's not this bad.

Why? Because a) Maven central is moderated better b) Maven has <exclusions> to override crap if necessary. c) The JRE includes a much richer standard library that doesn't force you to rely on 3rd party deps for things like random number generation or HTTP calls.