Debugging in Lime

Most coders think debugging software is about fixing a mistake, but that’s bullshit. Debugging’s actually all about finding the bug, about understanding why the bug was there to begin with, about knowing that its existence was no accident. It came to you to deliver a message, like an unconscious bubble floating to the surface, popping with a revelation you’ve secretly known all along.

Mr. Robot, "eps1.2d3bug.mkv"

Since one of the important things about Lime is continuity and completeness, I decided I'd implement a debugging system.

It feels hypocritical to work on a debugger, given that I've never really used one. I've tried a couple times, but I always fall back to printf debugging. Turns out I'm not the only one:

I don't like debuggers. Never have, probably never will. I use gdb all the time, but I tend to use it not as a debugger, but as a disassembler on steroids that you can program. None of the arguments for a kernel debugger has touched me in the least. And trust me, over the years I've heard quite a lot of them.

excerpt from linux kernel mailing list, from

I definitely agree with Torvalds' view. Since debugging is essentially the process of understanding

The principles I'd like to follow in designing debugging architecture are:

  • Provide all the context necessary to understand the program's execution state at a breakpoint; but
  • Only provide the context explicitly requested by the user.

In my view, the ideal system that allows the user to precisely specify what information to view or operations to perform is a programming language itself. I've realized that "printf debugging" is so appealing to me because it is programmed inline with my code.

Here's a few ideas I have for how to implement debugging systems in Lime.

Bracket Expressions

(function abc () (f ?[a b c])

Bracket expressions, using ?[] would dump the context of a function application; the names of all the arguments, their values, as well as the value of the function pointer.

Variable Dumping

(iprint ?a)

Variables can be dumped by prefacing a certain reference or variable with a ? character.


A dump expression can be converted into a breakpoint by changing the ? to a ?!. When executing the Lime program, the dump will execute, and the code may be stepped through.