interactively debugging a Forth square root

by kragen
GNU/Linux ◆ xterm-256color ◆ bash 349 views

I just wrote an integer square root function in Forth as an example of debugging with variables that still exist (because Forth variables aren’t on the stack normally).

It’s kind of a dumb example maybe, because I didn’t plan the bug, but I did have one and then did have to debug it. :) Also, it’s maybe slightly artificial that I’m not using the stack…

The video is a little slower paced than it could be because I forgot that gforth has command-line editing; it’s over 4 minutes long, so maybe you’ll want to watch it sped up.

See if you can spot the bug before I did!