Re:Rust is a hard way to make a web API
by hamandcheese on Friday January 15, 2021 @10:40PM
(#25799815)
I’m not the one you asked, but I think go is also a fine language for command-line tools, thanks to is truly breezy cross-compilation story.
Re:Rust is a hard way to make a web API
by ericbarrett on Friday January 15, 2021 @11:33PM
(#25800066)
The ability to trivially cross-compile in Go, and get a single-file executable artifact, is often mentioned but still not appreciated enough. This is still a multi-hour project, minimum, for most languages, especially if you are introducing a second platform to a well-established project. In Go, it‘s a compiler flag.
I think between http, encoding/json, and the io libraries, it’s also very simple and straightforward to do most of the things a typical command-line program does, in a cleaner way than shell or Python (both have their place) and with less fuss than Rust or C++.
Re:Rust is a hard way to make a web API
by krferriter on Friday January 15, 2021 @11:57PM
(#25800171)
There's a relatively large difference in executable size, which might matter in some situations. And in run time. For executables that can get put to task doing a lot of heavy lifting and hammering on memory resources like grep and awk and others, it might make a real difference.
Do you agree with the article's recommendation of Rust for command-line tools, or do you think Go is the right tool for that job as well?
Or perhaps I should stick with C++? For one thing, it's nice to be able to re-use code between command-line tools and other C++ programs, which AFAICT would be a bit harder between Rust & C++ and much harder between Go & C++.