Hacker News new | ask | show | jobs
by ohnoesjmr 904 days ago
Is it just me, or the worst part of coroutines is lack of tooling around them? Whenever I get a crash in a coroutine, the "stacktrace" is totally useless and doesn't actually show where the crash happened, just some boiler plate code around executing some continuation which doesn't refer to real code that you wrote.
1 comments

more or less agree, although this issue isn't even really unique to C++. in practice it's still worth it imo, since debugging callback heavy stuff isn't exactly fun either
You'd still have lines referring to a callback you've writtem. I found it that with coroutines, not even a single stackframe refers to my code , other than the one starting the loop.
code that uses coroutines is often a lot more straightforward than callbacks. with callbacks, it can also be non-trivial to even find out where / when some delegate was set. it's also often difficult to even navigate / read a single chain of actions without having to jump back and forth across several files, while also needing to follow around a trail of random variables. i'd still make the trade over to coroutines every single time. i'm definitely biased, though. i really really hate working with callback heavy code

(what i've usually done for hunting down coroutine errors is use a tracing profiler, or i guess just printf debugging. it is probably the worst part still, tho)