3 ms·
> With closures you often end up with circular references. In that case, you can manually lift the data object involved into a function argument, as opposed to
by zozbot234 6y ago
> With closures you often end up with circular references.
In that case, you can manually lift the data object involved into a function argument, as opposed to a variable capture - with its ownership being thus managed explicitly. This is generally an improvement in design.
Of course, Rust does only solve memory management problems "to a point"; there are cases where fully general GC is pretty much a necessity. But even most uses of closures - a fairly high-level language feature, all things considered - don't require this in many cases.