Hacker News new | ask | show | jobs
by jedisct1 883 days ago
But until you're an experienced Rust programmer, you may frequently hit walls, spending a considerable amount of time trying to implement something that would be trivial in other languages, but requires a lot of contorsion to compile in Rust.

And once it compiles, the way you achieved it may be suboptimal, complicated, buggy, and even unsafe due to logic bugs.

My fairly large projects written in Rust have slowly become unmaintainable. There 's too much code that's just there to work around the borrow checker, and hurt readability. There are memory leaks and dead locks that I've never been able to pinpoint. There are dependencies that I stopped updating a long time ago due to constant breaking API changes. There are "unsafe" and "transmute" keywords because I couldn't figure out how to go through many layers of abstraction just to copy a type that resolves to an integer into another type that resolves to the same integer.

I've been writing Rust code for 10+ years and I still appreciate it for some projects, but I also really enjoy going back to C for the control, flexibility and expressiveness it offers, not to mention better performance. After Rust, it feels like fresh air.

1 comments

Currently working on a ~120kloc Rust project, which is currently in its third year of existence. It's by far the easiest codebase to maintain I've ever worked in. Our only use of `unsafe` is for the sake of wrapping a C++ library from AWS, which also happens to be where our only use of `transmute` is. I'm able to make sweeping refactors across the entire codebase quickly and without stress. We try to encode logic in the type system where we can and make heavy use of Rust's enums, which makes the compiler able to catch the large majority of issues we might run into.

I think that if you avoid reaching for `unsafe` every time you're frustrated with the type system, you'll have a much better time.