News for hackers. Stuff that matters.
Re:Go vs. Rust: Writing a CLI Tool by ThanhMB4332 on Monday August 03, 2020 @11:52PM (#24046388)
Most importantly, like many articles and discussions regarding Rust, this article misses the point. It's not about high end language features. In 99% of the projects it's also not about computational performance (but latencies - memory, network, disc and scalability).

Success of our projects is ultimately shaped by the development process, the matureness and reliablity of the ecosystem (standard lib of Go) and ease of use of the tools, so you can focus on the problem to solve.

Besides of that: I haven't written much Rust, so I can only comment on the Go side:

I never heard of GVM (local env for Go) - probably because it's not needed. Just use Go modules. Really, no need to worry about GOPATH etc.

Regarding the conclusion:

Rust is ultimately faster and uses less resources, no dispute here. However, there're no benchmarks in the article. For the given CLI application, the result would very likely be: There's no performance difference.

However, Rust is not generally safer than Go. Rust is safer compared to other language with manual memory management (C/C++). Rust has a stronger typesystem, but that doesn't mean Rust programs can't panic too.

Re:Go vs. Rust: Writing a CLI Tool by pkolaczk on Tuesday August 04, 2020 @01:10AM (#24046850)
Rust can statically prove there are no data races, Go cannot.

Rust offers statically checked deterministic destruction, which makes handling non-memory resources much safer from leaks. Failing to dispose non-memory resources properly (e.g in databases) may be considered a correctness problem. Rust helps in this area, Go doesn't.

Re:Go vs. Rust: Writing a CLI Tool by dpc_pw on Tuesday August 04, 2020 @02:44AM (#24047336)
Does Go have anything even close to clap/structopt?
Re:Go vs. Rust: Writing a CLI Tool by alecthomas on Tuesday August 04, 2020 @07:12AM (#24048760)
Yes, though unlike Rust they use reflection: https://github.com/alecthomas/kong (my own)
Re:Go vs. Rust: Writing a CLI Tool by dpc_pw on Tuesday August 04, 2020 @02:22PM (#24052930)
Thanks. Looks good. The reflections don't bother me (that's the way to go with in Go).
Re:Go vs. Rust: Writing a CLI Tool by saturn_vk on Tuesday August 04, 2020 @10:30AM (#24050330)
For cli apps it doesn't really matter if it's reflection-based
Re:Go vs. Rust: Writing a CLI Tool by c-cube on Tuesday August 04, 2020 @01:06AM (#24046828)
Rust is a bit safer.

- it warns you if you ignore an error. - it forces variables and fields to be initialized. - it has sum types and generics instead of interface{}. - it prevents some race conditions at compile time. - it pushes programmers towards immutability.

Re:Go vs. Rust: Writing a CLI Tool by pkolaczk on Tuesday August 04, 2020 @01:14AM (#24046869)
It doesn't only WARN about ignoring an error, it refuses to compile. T and Result<T, E> are different types.
Re:Go vs. Rust: Writing a CLI Tool by kd5bjo on Tuesday August 04, 2020 @07:16AM (#24048783)
The warning comes if you try to call a function for its side effects and ignore the return value. In most cases it’s fine, but ignoring a Result or a Future will issue a warning.
Re:Go vs. Rust: Writing a CLI Tool by saturn_vk on Tuesday August 04, 2020 @10:31AM (#24050348)
I've always wondered whether "unwrap"-ing is considered ignoring? I personally always equated it to ignoring if there's an error
Re:Go vs. Rust: Writing a CLI Tool by steveklabnik on Tuesday August 04, 2020 @10:40AM (#24050450)
I would say no, because it's not ignored. It makes it explode.
Re:Go vs. Rust: Writing a CLI Tool by wwright on Tuesday August 04, 2020 @07:50AM (#24048993)
They also try to have aggressive defaults on integer wrapping and so on. I work with a junior who is writing a Go program who would have benefited from the early detection ;)
Re:Go vs. Rust: Writing a CLI Tool by loopz on Tuesday August 04, 2020 @07:18AM (#24048788)
For a naive code solution, I found the default naive golang code to be better performing than Rust, when processing multiple files together (I/O-bound). I'd be careful assuming Rust is faster by default, as Go has some pretty sane defaults out of the box. The developer experience is faster, simpler and stabler(?) too, but really depend what you want to make. I find Rust interesting but haven't found the time/project to learn it properly on. Point being to avoid costs and risks of premature optimizations.
Re:Go vs. Rust: Writing a CLI Tool by steveklabnik on Tuesday August 04, 2020 @07:43AM (#24048941)
Often, slow file reading means that you didn't use a BufReader, and are making more system calls than you need to.
Re:Go vs. Rust: Writing a CLI Tool by kryps on Tuesday August 04, 2020 @08:34AM (#24049290)
Tip: Rust BufReaders default to 8KiB buffers which are way too small for high-performance sequential NVME I/O.
Re:Go vs. Rust: Writing a CLI Tool by fileeditview on Tuesday August 04, 2020 @06:36AM (#24048564)
GVM is really handy if you need to switch between go versions fast. I use it often at work and it's great for that. If you never do that, you don't need GVM.