4 ms·
I thought so too at first, but the thing about the limits imposed by the borrow rules is that they completely avoid the bugs that, in my experience, take the lo
by cfallin 10y ago
I thought so too at first, but the thing about the limits imposed by the borrow rules is that they completely avoid the bugs that, in my experience, take the longest to track down in e.g. C++. It's the pain-up-front vs. more-pain-during-debugging argument. I've slowly been converted to the former camp from the latter as I write Rust full-time. The experience is just more... deterministic and pleasant. (Have you ever accidentally kept a pointer to an element of a std::vector too long and then caused the vector to reallocate?)
If you want you can always use raw pointers and dereference them in unsafe {} blocks, and even provide a safe API (return borrows with appropriate lifetimes) around this. You'll find plenty of common patterns in the standard library and on crates.io too.