r/rust • • Nov 17 '22

What are Rust’s biggest weaknesses?

What would you say are Rust’s biggest weaknesses right now? And are they things that can be fixed in future versions do you think or is it something that could only be fixed by introducing a breaking change? Let’s say if you could create a Rust 2.0 and therefore not worry about backwards compatibility what would you do different.

220 Upvotes

390 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Nov 18 '22

I think the lifetime abstractions and associated meta-programming is the worst offender here.

Lifetimes can be avoided almost always. I think you're stuck in OOP land and having a hard time adjusting.

I felt I really had to rethink my first intuition for every pattern I wanted to implement in Rust at first. I started with a game framework / rendering engine, meaning I had to plan ahead. If you just think you can learn Rust by simply doing, you're going to have a bad time.

Anytime you'd have a lifetime in a field inside a struct, rethink everything. Make it Rc/Arc or Box it if you have to. Borrowing in Rust should be short term only.

2

u/ericanderton Nov 18 '22

Thanks for the encouragement. I appreciate it, and will take this with me when I take up Rust again.

I swear, this has to be the most polite community on Reddit.

1

u/[deleted] Nov 18 '22

There's elitism in any corner of the internet, but on the whole the Rust community is pretty cool.

I think it being the most loved language for, what, 5 years in a row now must have something to do with it.

There are times when I write something in Rust and I feel like a genius (which I'm most definitely not), simply because Rust forces you to think about memory allocations / ownership very carefully. Often that results in rather verbose but very elegant patterns.

It might not be for everyone, but I bet that if you stick with it and exercise patience, you'll love Rust. I used to love C#, now I find it very cumbersome if performance is paramount (which it is for games, obviously).

Good luck!