← Back to context

Comment by openuntil3am

13 hours ago

Closures are a complicated mess. Functional programming languages hide the mess with garbage collection.

This 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.