I've been programming quite a bit in expl3 for the last weeks, and while I really like the expressiveness of the provided API, what often is incredibly painful is debugging larger programs.
In many circumstances, I find the various \xxx_show: functions very useful to query the values of variables and see what's going on at execution. For more readable debugging output \iow_term:x and other I/O functions can be used. l3basics also provides some built-in debugging facilities to check for assignments to undeclared variables, wrong arithmetic expressions and a few other things, which I never felt pretty useful, though.
Sometimes all those do not help anymore when things like expansions go wrong and TeX aborts with an utterly unhelpful low-level error message. In TeX or LaTeX2e using \tracingmacros or \tracingcommands often reveals the problem quickly.
In expl3, however, the tracing output is almost always too verbose to be actually helpful. For example, if I enable macro tracing in the example document from my question about parsing balanced groups only outside of all cctab functions, I get about 7600 lines of log output. If the few cctab function calls are included into the tracing, the log file blows up to 120k lines! Similar things happen for seemingly innocent functions like the \xxx_show: functions. It's no fun to scroll around in hundreds and hundreds of lines of code just to locate one of the functions you actually called in your program.
So are there other tools to aid in debugging of, in particular, expl3 programs/package code? Or is there a way to selectively mute the tracing output for specific sets of functions, e.g. all kernel functions? If not, what plans are there to support more debugging facilities in future expl3 versions?
\unravelfrom theunravelpackage very useful, but it's not perfect and doesn't support every aspect of TeX. Breaking the code in smaller parts and checking whether each part does exactly what you think it does is generally a good habit. And the naive debugging variant of putting\typeout(or similar) all over the place to see at which point the error happens :) Else rubber-ducking is always a useful approach. – Skillmon Nov 16 '19 at 08:47ExplSyntaxOnandExplSyntaxOffcount? ;-) – Phelype Oleinik Nov 16 '19 at 15:29