Final recap video.
Debugging tools today tend to be language-specific, require lots of knowledge of the internals of a language runtime, and therefore to be quite complex. The focus is on debugging heavyweight programs with low overhead, and the predominant paradigm is to slow time down and permit stopping at specific lines (breakpoints). Time-travel debugging remains esoteric, as do user-configurable views of datatypes.
A complementary approach is debug by print. It requires no tooling support and naturally lays out a program run over time. However, you have to choose to either clutter up your codebase with debug prints (maybe disabled) or delete them and re-add them every time, which makes it harder to disseminate debugging tricks with your collaborators. It also doesn't permit other media.
This project makes debug by print more ergonomic by adding a little bit of structure to source code that tooling is aware of:
lines in source code can have an optional fold character. Text after the fold character (debug prints in green below) is hidden by default in the editor, and expanded on demand.
If programs provide instructions for interpreting patterns in log lines, the editor can render log lines graphically, making lots of dense information easy to read at a glance. Here are example logs for a Pong game:
If programs follow a specific convention for section headings, the editor folds section contents away and lets people drill into sections on demand.
Final recap video.
Today I added some idioms for dividing up a log of debug prints into nestable sections, showing them collapsed by default. Here's a demo of the complete experience of opening up a log file, exploring it and potentially jumping from a log line to the precise &bifold-text code that generated it.
The editing environment only knows about lines and sections in the log file; the notion of 'session', 'game' and 'trajectory' are specific to the particular client codebase/game being debugged.
2-minute demo of how far I've gotten with &bifold-text. Ends pretty much as you would expect.
I seem to be past the "black triangle" phase of my project &bifold-text, so tonight I had some fun. I built a little game using my new text editor. Here's what the source code looks like normally, and revealing debug prints. Finally, just for eye-candy, a video of me playing the game. You'll have to trust me that the debug prints work 😃
Not much progress today.. I may have bitten off more than I can chew. What else is new? 😅 &bifold-text