▲ | TuxSH 5 days ago | |
Capturing lambdas are no different from handwritten structures with operator() ("functors"), therefore it makes no sense castrating them. Borrowing from stack is super useful when your lambda also lives in the stack; stack escaping is a problem, but it can be made harder by having templates take Fn& instead of const Fn& or Fn&&; that or just a plain function pointer. | ||
▲ | loeg 5 days ago | parent | next [-] | |
Convenience is a difference in kind. Like, I'm not god's gift to programming or anything, but I'm decently good at it, and I wrote a use-after-return bug due to a lambda reference last week. | ||
▲ | sunshowers 5 days ago | parent | prev [-] | |
Borrowing from the stack is definitely useful. I do it all the time, safely (truly safely), in Rust. |