The Lambda Coroutine Fiasco
https://github.com/scylladb/seastar/blob/master/doc/lambda-coroutine-fiasco.mdIt's amazing C++23's "deducing this" could solve the lambda coroutine issue, and eliminate the previous C++ voodoo.
44
Upvotes
View all comments
Show parent comment
1
u/patstew Dec 18 '25 edited Dec 18 '25
I would've thought the answer to this is usually 'yes it should', especially if you're taking a
&&? If people desperately want to reference an object they can always make a little[&](){return f();}wrapper which at least makes it obvious where you're doing something questionable with lifetimes.What you want to avoid is the future returning from a coroutine who's state is owned by future's storage isn't it? So you need to return something else in that scenario that effectively owns the coroutine state, roughly a
pair<Coro, Ret>.