5 ms·
Mutability makes it worse, but there are at least some issues with borrowing that have nothing to do with mutability. If your experience is with garbage collect
by hyperpape 10y ago
Mutability makes it worse, but there are at least some issues with borrowing that have nothing to do with mutability. If your experience is with garbage collected languages, I suspect you'll encounter errors that surprise you.
- stable-point 10y agoCould you provide an example where the borrowing would cause issues for immutable data? I'm still learning Rust, but I thought the fact that you could have as many immutable borrows as possible would limit what errors the borrow checker could throw at you.
- hyperpape 10y agoThis is embarrassing, but I'm now second-guessing whether what I wrote was accurate. Sorry. In penance, here are some links: https://www.reddit.com/r/rust/comments/5ny09j/tips_to_not_fight_the_borrow_checker/ https://www.reddit.com/r/rust/comments/5ny09j/tips_to_not_fi... https://m-decoster.github.io//2017/01/16/fighting-borrowchk/ https://m-decoster.github.io//2017/01/16/fighting-borrowchk/
- stable-point 10y agoFantastic! Thanks a lot in any case. I do find the image of "fighting the borrow checker" is quite harmful to how people view Rust. As those links state, an important aspect of teaching Rust is educating people about why the borrow checker complains, so that they might adjust their mental model.