3 ms·
> Just, for example, creating a closure that references a variable outside of its scope is not simple. It's a lot simpler and more performant than in other lan
by zozbot234 6y ago
> Just, for example, creating a closure that references a variable outside of its scope is not simple.
It's a lot simpler and more performant than in other languages. Rust will tell you if the closure might outlive the variable you're referencing, and it's easy to pick the best option for addressing the issue (move semantics, Rc<>/Arc<>, lifetime specifiers etc.) while keeping best-in-class performance. This is a big part of what Rust is best at, and it's hard to get these advantages any other way.
- nicoburns 6y agoYeah, I've definitely had hard to find memory leak issues in JS code due to things like this, which rust prevents with a compiler error.