4 ms·
Idiomatic programming in a functional language requires garbage collection. There is a reason languages like OCaml and Haskell have a garbage collector. Without
by amelius 1y ago
Idiomatic programming in a functional language requires garbage collection. There is a reason languages like OCaml and Haskell have a garbage collector. Without it, programming in these languages would be completely different.
If you look at it from that perspective, then Rust is the hobby language.
- zx8080 1y ago> Without it, programming in these languages would be completely different. How different?
- zozbot234 1y ago> Idiomatic programming in a functional language requires garbage collection. Rust has functional programming features and no garbage collection, because the borrow checker can tell when a closure will outlive the references in its captured environment. We used to think that would not be feasible other than perhaps in very special cases - hence the need for GC to keep that environment around - but Rust proved that wrong quite convincingly.
- amelius 1y ago"Having FP features" does not mean "allow an idiomatic FP programming style". If this were the case, we'd be seeing a revolution in functional programming now. It's not like the FP community is slow to adopt good ideas. In fact, many innovations that lead to the invention of the borrow checker came from the functional programming world (linear, affine types, effect systems).
- zozbot234 1y agoWhat's an "idiomatic FP programming style"? Is typical LISP code "FP" enough? That uses GC of course, but other than that it's often high-level enough to be quite comparable w/ modern Rust.
- dontlaugh 1y agoNot necessarily GC, but any kind of automated memory management that allows composition.