6 ms·
As person who uses both Rust & Go at my $DAYJOB, I would say, both have their merits and demerits, I think, we should view them as tools instead of attaching ou
by mfrw 5y ago
As person who uses both Rust & Go at my $DAYJOB, I would say, both have their merits and demerits, I think, we should view them as tools instead of attaching ourselves to any particular language emotionally. I like to think them as different tools for different use-cases. Use the right tool for the right job. In my opinion, go does an excellent job at networking (TLS/HTTP) & quick cli apps while rust shreds text & does an amazing job at memory management (this is a figurative example; don't drone me if I missed your favorite feature).
- dmart 5y agoI often see people recommend Go for CLI apps but I'm not sure why. The built-in `flag` package is really limiting. These days I mostly use Rust with `clap` which is the nicest flag-parsing experience I've found so far in any language.
- alain_gilbert 5y agoAre you using "clap" because the "built-in" one in rust is not good? :P
- cesarb 5y agoThere is no "built-in" command line parser in Rust. All it has is std::env::args (https://doc.rust-lang.org/std/env/fn.args.html https://doc.rust-lang.org/std/env/fn.args.html) and std::env::args_os (https://doc.rust-lang.org/std/env/fn.args_os.html https://doc.rust-lang.org/std/env/fn.args_os.html), which give you the raw command line. Rust does not follow the "batteries included" philosophy for its base standard library, to avoid "leaking batteries" problems like seen for instance with Python (https://news.ycombinator.com/item?id=19948642 https://news.ycombinator.com/item?id=19948642).
- alain_gilbert 5y agoI know there is no flag library built-in in rust (I do quite a lot of rust as well as go). That's my whole point. It should be compared to something like https://github.com/urfave/cli https://github.com/urfave/cli . That would be a fairer comparison.
- dmart 5y agoSure, for example I usually use Cobra. But what I meant was that people often mention Go as being explicitly preferable to Rust for CLIs, and I’m not sure why if I have to pull in a dependency in either case.