Re:Go 1.18
by yawaramin on Tuesday March 15, 2022 @07:39PM
(#30693403)
Rust isn't a functional programming language. You could try OCaml, it's kind of a halfway point between Go and Haskell.
[ Parent
| on HN ]
Rust has first-class functions. Not only that, but it also has immutability by default, and ADTs with pattern matching. If OCaml is functional, why wouldn't Rust be?
Because of lifetime of captured variables in closures, mostly.
You can't really pass around functions freely like you would in Haskell/ML unless you start Box-ing/Rc-ing everything. But then it's not really idiomatic Rust anymore, IIUC.
Rust doesn't really have first-class functions - you can't take an arbitrary snippet of code and turn it into a function value, because sometimes it will no longer pass the borrow checker.