| ▲ | amelius 4 hours ago |
| Closures are the bread and butter of functional programming, but Rust made closures a complicated mess. |
|
| ▲ | openuntil3am 4 hours ago | parent | next [-] |
| Closures are a complicated mess. Functional programming languages hide the mess with garbage collection. |
|
| ▲ | Klonoar 4 hours ago | parent | prev | next [-] |
| If you understand the borrow checker, closures are just not that much on top of things. In fact I can’t remember the last time I had to fight with them. |
| |
| ▲ | convolvatron 3 hours ago | parent [-] | | I really wanted just yesterday to create a dyn AsyncFnMut, which apparently still needs async-trait to build the stable. but I was pretty much unable to figure out how to make that work with a lambda. saying this is all trivial once you understand the borrow machinery is really understating it. | | |
| ▲ | kibwen 3 hours ago | parent | next [-] | | > saying this is all trivial The comment above isn't saying that closures are trivial. Once you understand the borrow checker, you understand that it's a miracle that closures in Rust can possibly work at all, given Rust's other dueling goals of being a GC-less language with guaranteed memory safety despite letting closures close over arbitrary references. Rust is in uncharted territory here, drawing the map as it goes. | |
| ▲ | speed_spread 2 hours ago | parent | prev [-] | | Async is the stuff that messes up everything. Closures are not complicated. |
|
|
|
| ▲ | ordu 3 hours ago | parent | prev [-] |
| Well... Rust is not a functional language, so it is not surprising that its closures are complicated. |