3 ms·
> how many function types does Rust have again? Three? It has to, right? ATS has many function types as well, plus stack-allocated closures (I think Rust has t
by vmchale 6y ago
> how many function types does Rust have again? Three?
It has to, right? ATS has many function types as well, plus stack-allocated closures (I think Rust has that too??)
- steveklabnik 6y agoRust's closures do not heap allocate unless you box them, like any other struct, because closures are sugar for a struct + a function, that's correct. (and yes, there are three types of closures, because they need to know if they take said struct by reference, by mutable reference, or by owner.)
- ragnese 6y agoIt does have to, because of the way mutation and ownership work. Which is great! But it makes functional programming awkward. The language does not "steward" you toward function composition.