> I get it that JavaScript/Python etc... programmers who always had a garbage collector might have trouble.
FWIW, as a JS/Python programmer I didn't run into borrow checker issues on my most recent Rust foray -- I think it's gotten easier over time with stuff like non-lexical lifetimes?
What I did run into was differences in error handling. If you're used to exceptions it takes a while to get a feel for the variety of idioms that replace them, particularly the chains of and_then().unwrap_or().map().filter().ok().filter_map() that are more familiar for folks coming from pure functional languages.
> FWIW, as a JS/Python programmer I didn't run into borrow checker issues on my most recent Rust foray -- I think it's gotten easier over time with stuff like non-lexical lifetimes?
It also varies hugely according to what kind of program you're writing. Some programs naturally have borrowcheck-friendly structures, others don't.
For example, i wrote a program which processes network packets. There is a main loop which reads packets, then passes them down a pipeline of filtering, extraction, and other processing, eventually sending out more network packets. From the compiler's point of view, the pipeline is just a series of nested function calls. Each call can safely borrow from any of the enclosing scopes. Some of the stages are stateful, but they manage their own state, copying data to and from the packets. There's nowhere in a program like this that you run into a problem with borrowing, it all just flows naturally.
> If you're used to exceptions it takes a while to get a feel for the variety of idioms that replace them, particularly the chains of and_then().unwrap_or().map().filter().ok().filter_map() that are more familiar for folks coming from pure functional languages.
Coming from JS, this felt familiar to me too: It's virtually identical to how handling errors in Promise chains works.
FWIW, as a JS/Python programmer I didn't run into borrow checker issues on my most recent Rust foray -- I think it's gotten easier over time with stuff like non-lexical lifetimes?
What I did run into was differences in error handling. If you're used to exceptions it takes a while to get a feel for the variety of idioms that replace them, particularly the chains of and_then().unwrap_or().map().filter().ok().filter_map() that are more familiar for folks coming from pure functional languages.