10 ms·
When I say closure I mean anonymous functions that capture their environment, esp. in a mutable way. Those work fine in Rust for simple use-cases, but it gets
by cube2222 3y ago
When I say closure I mean anonymous functions that capture their environment, esp. in a mutable way.
Those work fine in Rust for simple use-cases, but it gets annoying quickly.
With a garbage collected language like Go, closures can freely capture stuff, use it, and then once no closure (or any other code, fwiw) references it anymore, it gets freed.
Escape analysis and garbage collection make even more complex (like closures that outlive the scope) use cases (where lifetimes would be hell) trivial.