7 ms·
Closures are a complicated mess. Functional programming languages hide the mess with garbage collection.
by openuntil3am 8mo ago
Closures are a complicated mess. Functional programming languages hide the mess with garbage collection.
- andrewflnr 8mo agoThis isn't the right framing IMO. Closures actually aren't complicated with GC for the same reason structs with references aren't complicated, at least as far as the programmer is concerned. You could say functional languages "hide the mess" there too, but even if you take that perspective, it's nothing to do with closures in particular. Closures are just one of the things that need memory, and memory management is tricky without GC.
- armchairhacker 8mo agoMachine code and LLVM are complicated messes. Higher-level language hide a lot, but sometimes issues pop up, even in Rust e.g. inline heuristics (https://nnethercote.github.io/perf-book/inlining.html https://nnethercote.github.io/perf-book/inlining.html).