Live data from Hacker News

Switching from C++ to Rust

laplab.me

1–10 of 289 posts

Re: Switching from C++ to Rust

#2
Nice to see some level-headed anecdotes on the experiences of actually _using_ each language, as opposed to the usual "z0mg rustc fixez all yur mem0ry bUgz!!111one"

And, as someone who's spelunking in the depths of a large CMake project right now, cargo sounds pretty nice.

Re: Switching from C++ to Rust

#3
The call out to sum types is something I feel. I've been using Rust daily for almost 10 years now, and sum types are absolutely still one of the things I love most about it. It's easily one of the things I miss the most in other languages that don't have them. I'm usually a proponent of "using languages as they're intended," but I missed exhaustiveness checking so much that I ported a version of it to Go[1] as a sort of lint.

[1]: https://github.com/BurntSushi/go-sumtype

Re: Switching from C++ to Rust

#4
I didn't know Vatic Labs was a Rust shop! (I joke, but they are a finance firm that is notoriously paranoid about you announcing where you work).

I'm glad to hear about your experience with the language as a developer. It's also been my experience that Rust has the magical power where your compile errors are almost always logic bugs. That's pretty cool from a psychological perspective, because you really feel like your C++ compiler is your enemy (or worse, your lawyer) while the Rust compiler is your friend.

The C++ developer experience is absolutely horrendous (with far too much of the unholiness that is cmake), and I hope that shedding some light on the situation can help people understand how to make it better.

Re: Switching from C++ to Rust

#5
The most fun thing reading this comparision is again that for an experienced C++ programmer who is used to managing memory by hand (and fixing segfaults), Rust's memory model doesn't seem that hard, because it makes sense, and he understands why the checks are important.

Re: Switching from C++ to Rust

#6

The call out to sum types is something I feel. I've been using Rust daily for almost 10 years now, and sum types are absolutely still one of the things I love most about it. It's easily one of the things I miss the most in other languages that don't have them. I'm usually a proponent of "using languages as they're intended," but I missed exhaustiveness checking so much that I ported a version of it to Go[1] as a sort…

Agreed. I don't have much Rust experience, but I do know Scala and Haskell and Typescript.

It's one of those patterns that just comes up again and again and it's wonderful when the language offers a good solution.

Re: Switching from C++ to Rust

#7
post #2

Nice to see some level-headed anecdotes on the experiences of actually _using_ each language, as opposed to the usual "z0mg rustc fixez all yur mem0ry bUgz!!111one" And, as someone who's spelunking in the depths of a large CMake project right now, cargo sounds pretty nice.

Cargo is really nice! First party integration of developer tools is a big step forward and it’s nice to see it become more widespread (other examples include golang and Terraform)

Bryan Cantrill has a number of talks about Rust which are similarly pragmatic

Re: Switching from C++ to Rust

#8
> What kind of C++ and Rust?

I appreciate the inclusion of this section. Different people writing C++ can have wildly different experiences, based on the type of things they are working on. This section offers a good reminder about this, and that one person's perspective is not more or less correct than anyone else's.

Re: Switching from C++ to Rust

#9
post #2

Nice to see some level-headed anecdotes on the experiences of actually _using_ each language, as opposed to the usual "z0mg rustc fixez all yur mem0ry bUgz!!111one" And, as someone who's spelunking in the depths of a large CMake project right now, cargo sounds pretty nice.

Rust advantages are one third memory safety, one third types, and one third package management.

Re: Switching from C++ to Rust

#10
post #5

The most fun thing reading this comparision is again that for an experienced C++ programmer who is used to managing memory by hand (and fixing segfaults), Rust's memory model doesn't seem that hard, because it makes sense, and he understands why the checks are important.

Rust's memory model is even more familiar to C++ programmers who don't manage memory by hand because they have the same concepts of borrowing and lifetimes.
Post reply on HN