Now that I've started inserting coroutines into my apps (https://futureofcoding.slack.com/archives/C0120A3L30R/p1698818828191999) to make them more debuggable, I'm starting to find and plug gaps in error recovery:
• I have to be careful to check the results of coroutine operations, because the underlying coroutine might have thrown an error.
• Errors in Lua include a call stack, but errors within coroutines don't return the stack by default.
• If I create a higher-order helper to abstract away the coroutine munging just to smear a computation across frames, does that impact the quality of debug information in the call stack? (Answer: no it doesn't in Lua, but it wasn't obvious.)
• Call stacks returned by LÖVE aren't quite as clean as plain Lua.
J. Ryan Stinnett
11/09/2023, 6:47 PM
How would you rate the Lua / LÖVE debug experience overall? Do you generally get meaningful stack traces? Are there debuggers that work as expected? (Feel free to tell me to go away and figure it out myself! 😇)
11/10/2023, 12:47 AM
I think it's pretty decent. Baseline Lua gives nice stacks to show you precisely where an error happened. But as a dynamic language it also gives you tools to try to 'improve' on it, and when I run into problems it's invariably because I was trying to be clever and my improvements like driver.love regress the experience. LÖVE is a bit like that as well albeit much more mature than my stuff; it has one issue I've noticed that baseline Lua doesn't have.
I tend to be a debug by print person so haven't played with debuggers like https://github.com/deltadaedalus/vudu much. So it might fall to others to review the debugger side of the eco system. But things have seemed decent enough to me.