2 ms·
100%. Newcomers still struggle a bit, especially if they've never used C/C++ before. A good way to get people comfortable with the semantics of the language be
by echelon 1y ago
100%. Newcomers still struggle a bit, especially if they've never used C/C++ before.
A good way to get people comfortable with the semantics of the language before the borrow checker is to encourage them to clone() strings and structs for a bit, even if the resulting code is not performant.
Once they dip their toes into threading and async, Arc<Lock<T>> is their friend, and interior mutability gives them some fun distractions while they absorb the more difficult concepts.
- mre 1y agoDo you mean `Arc<Mutex<T>>`? Yeah, I agree. Wrote a blog post on that topic as well: https://corrode.dev/blog/prototyping/ https://corrode.dev/blog/prototyping/ The title is a bit of a misnomer, but it's about beginner-friendly escape hatches in the language. Perhaps it's useful to newcomers.
- echelon 1y agoAny lock, but that's generally the best choice. Great post! It's got a ton of advice for being productive, and it should be especially useful for beginners.