3 ms·
It really depends on what you are trying to do. Spending a month fighting the borrow checked doesn't seem normal to me. If you are implementing data structures
by kccqzy 10y ago
It really depends on what you are trying to do. Spending a month fighting the borrow checked doesn't seem normal to me.
If you are implementing data structures and stuff, you might want to read more about the actual limitations of the borrow checker. Some kinds of code just can't be done with the constraints of the borrow checker. Embrace unsafe blocks and then gradually try to move as much code as possible away from those unsafe blocks. Try to think of "unsafe" as merely "unverified by the compiler". There is nothing inherently evil about unsafe.
If you are doing more application-level programming, I recommend you to get acquainted with the functional style of programming, if you haven't done this yet. Pick a more conventional language and then try to implement something using as few assignments as possible. Get used to and embrace immutability. Once you are used to immutability, Rust will be much easier too.