HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Debugging Lisp: fix and resume a program from any point in the stack - how Common Lisp stands out.

vindarel1 HN recommender · recommended in 1 month, 2023-2025
YouTube
5K views · 3 years ago · demo · evergreen

A five-minute demo of the Common Lisp debugger fixing a bug, recompiling a single function, and resuming execution from the failed stack frame. It shows how to avoid re-running long computations.

HN Lisp fans repeatedly link it as a short, concrete demonstration of Common Lisp's interactive debugging advantage.

Functional programmingTesting, debugging & developer tools#commonlisp#slime#debugger#restarts#interactivedevelopment

12 comments from Hacker News

@vindarel2025 · in “A simple Common Lisp web app”

false premises, false conclusions, and bad good ideas in-between. > I was surprised by the absence of a quickstart page to help me set up a simple server what about link ? Also I think that the READMEs of Mito (ORM) and Djula (templating) and easy-routes (routing) are very good. Heck, Djula's documentation is excellent. Double heck, even Caveman's README, which the author uses, has a good and sufficient getting-started page. Oh, I understand, the author uses Clack/Lack… where Hunchentoot is much better documented. there are of course more blog posts, some videos. I invite any blogger to consolidate community resources. More recent: link ps: > ;; If the template is not already compiled, it is compiled, and stored in TEMPLATE-REGISTRY . won't that prevent the template to compile changes? I suggest to follow Djula's doc. > I would add a way to invalidate the cache automatically if a template changes. yeah. So don't do that ;) (also +1 to Jach's remarks and explanations) > I created a macro that ensure the table gets created correctly hummm… I'd suggest to leave the migration step explicit. > some database helpers to perform a few CRUD actions on the db. I felt the need for CRUD helpers too when defining Mito classes. However those four ones are only similar functions with same parameters but another name :] (defun db-add (instance) "Inserts a model instance into the database." (insert-dao instance)) > I would say that there are better languages for developing modern web apps

CitesView on HN
@trealira2024 · in “The plan-execute pattern”

> the code that is currently executing can be manipulated live Typically when people say this about Lisp, they mean that they can redefine functions and objects live, having all the code adapt to use the new definitions, or when their code hits an error, they can not only redefine functions and objects live, but also examine the state of the call stack and change the values of variables live, and then let the code run again. This[0] is a clear explanation that I found. There's also a video[1] that shows the same thing. However, I don't know if those apply to Scheme. Also, I am pretty sure it is unrelated to Lisp being homoiconic, and that it's more about it being dynamically typed and interpretable. [0]: link [1]: ▶ this video

CitesView on HN
@skydhash2024 · in “The Functional Programming Hiring Problem”

When you redefine a function in CL, every function that use this function is notified of the change and pickup the new version. And because it's functional and you're not supposed to modify the state outside your function, everything will keep churning. The issue with emacs is the sheer number of variables. And the fact they're global. That leads you to do stuff you shouldn't do. But the principles are essentially the same. And in CL, you can snapshot the current state of your program to a file. Then restart later, instead of reloading the environment from the code. A quick demo: ▶ this video

CitesView on HN
@vindarel2024 · in “Ask HN: 30y After 'On Lisp', PAIP etc., Is Lisp Still "Beating the Averages"?”

> all the other languages have kept picking up nearly everything once-cutting-edge about Lisp not all of them have CL's set of features: excellent long-live REPL, image-based development, compiling to binaries, the condition system, the interactive debugger and excellent developper tools (resumable stack frames, never re-run a long operation from zero [1]), the whole language at compile-time, stable syntax, extensible syntax, stable ecosystem, fast implementations, numeric tower, first-class interop to Java (LispWorks, ABCL), commercial support, mobile platforms delivery (LispWorks)… New CL implementations get created (CLASP, CL on C++ with LLVM or NPT, in C) and CL compilers and libraries evolve too [2]. SBCL is now callable as a shared library, it got a SIMD module, rumors say a bear party after ELS 2024 escalated and that they are adding coroutines soon. ECL is targetting WASM, all other major implementations had new releases. New libraries unlock new possibilities (Coalton: Haskell-like typing on top of CL), companies still pick CL today (CL is all the rage in quantum computing?), the community creates more resources and more tools such as, last but not least, new editor plugins o/ link (VSCode, Pulsar, Jetbrains, Sublime, Jupyter… Lem of course etc) [1]: ▶ this video [2]: link

CitesView on HN
@vindarel2024 · in “A Road to Common Lisp (2018)”

I suggest: do you find yourself often quitting the debugger and re-running the same test, the same task from the start? You can avoid that in CL. Just leave the debugger open, go to the buggy line ("v" on a stacktrace in Slime), fix the function, re-compile it on the fly (C-c C-c in Slime), come back to the debugger, resume the program from the stackframe you want, now it passes. If the first steps were taking 10 minutes, you just saved yourself some time. You don't need special needs for that, it's a fast workflow I use everyday. demo: ▶ this video debugging a complex stacktrace: Python VS CL: link Another important point: we debug everything while keeping the current state in memory (in the image). We don't have to re-create our test data. All the program state is kept live, until we restart the image.

CitesView on HN
@vindarel2024 · in “Why is Common Lisp not the most popular programming language?”

not true, sorry! And if some languages took features, the combination of them is unique in CL. Image-based REPL interactivity, condition system, interactive debugger, restarts, compile-time computing, compile-time checks, incremental typing, speed, a different object system, stability, single-file binaries, connecting to a remote system… Here we restart a buggy program from a single point in the stack: ▶ this video so we don't re-run everything from zero.

CitesView on HN
@vindarel2023 · in “Interactive Common Lisp Development”

To really discover what interactive, image-based CL development is about, my pointers: - ▶ this video (5min) my demo to show how to resume execution of a long running program, from the stack frame right before the bug, after having fixed and recompiled the function, without quitting the debugger hence without stopping the program, thus without restarting everything from zero. - link (20min)showing what saving and restoring an image does, differences between SBCL and LispWorks. - link developing a 3D graphics software. - link - debugging CL tools: link - and no: while we could deploy a ball of mud to production, we can also not and use traditional tools and techniques: build an executable from scratch, restart the app, reload state. But we can do everything in between too (inspect the running app, change it a bit, change it a whole lot (while staying in sync with local source code), use images to speed-up development etc).

RecommendsView on HN
@vindarel2023 · in “Common Lisp: An Interactive Approach (1992) [pdf]”

*and not only paste, but write, in the source file, the new definition, re-compile it (C-c C-c), and resume execution from a stackframe before this call. (a clarification for folks who would think we must paste in the REPL) That's useful not only for breakpoints but for errors. We can fix an error without re-running everything from zero. ▶ this video

CitesView on HN
@vindarel2023 · in “Spinneret: A modern Common Lisp HTML generator”

That's a short video I made to show this: ▶ this video It's a feature that is useful everyday, if only to speed up trivial things.

CitesView on HN
@vindarel2023 · in “It's 2023, so of course I'm learning Common Lisp”

> lots of interoperability libraries That's true. For cases when you want to start with a good set of libraries (json, csv, databases, HTTP client, CLI args, language extensions…), I am putting up this collection together: link It can be used as a normal Quicklisp library, or as a core image (it then starts up instantly) or as a binary. It can run scripts nearly instantly too (so it isn't unlike Babashka). We are ironing out the details, not at v1.0 yet. > handling a runtime error by just fixing the broken code--in-place, without any restarts [from the blog] Also (second shameless plug) I should have illustrated this here: ▶ this video We run a long and intensive computation and, bad luck, we get an error in the last step. Instead of re-running everything again from zero, we get the interactive debugger, we go to the erroneous line, we compile the fixed function, we come back to the debugger, we choose a point on the stackframe to resume execution from (the last step), and we see our program pass. Hope this illustrates the feature well!

CitesView on HN
@vindarel2023 · in “Why Lisp?”

Best of both worlds: write unit tests with an interactive debugger o/ Tell the test runner to not catch errors and let them pass through up to the debugger. Have a test fail, get the debugger, go to the buggy line (without quitting the debugger), fix the bug, compile the function with a keystroke (yes, one function), come back to the debugger, restart not the full operation, but the function call, the debugger frame where the error happened, and see the test succeed. You ran the test exactly once and fixed everything in the process, very quickly. This is exactly what we do everyday with the debugger, with trivial or complex code, with unit tests or regular code. An example: ▶ this video not with unit tests, it's an example on how to restart a precise frame, how to avoid re-running everything.

CitesView on HN
@vindarel2023 · in “Debugging Lisp: trace options, break on conditions”

Related to debugging, the follow up article: how to fix and resume a program from any point in the stack. Have the debugger pop-up, read the error message, go to the erroneous line ("v"), fix the code, compile the function (C-c C-c), come back to the debugger, press "r" on any point in the stack, see the program succeed. You did not have to re-run everything from zero. link ▶ this video and some more: link

CitesView on HN
Practical Common Lisp1:12:10

Practical Common Lisp

Google TechTalks
98K views • 19 years ago
Marco Baringer's SLIME Tutorial Video55:29

Marco Baringer's SLIME Tutorial Video

손주일 (Cecil)
33K views • 15 years ago
Web Development in Emacs, Common Lisp and Clojurescript - Emacs SG1:18:42

Web Development in Emacs, Common Lisp and Clojurescript - Emacs SG

Engineers.SG
14K views • 10 years ago
Escape from the Heap: Low-Level Programming in Common Lisp56:49

Escape from the Heap: Low-Level Programming in Common Lisp

Arthur Gleckler
17K views • 10 years ago
"Stop Writing Dead Programs" by Jack Rusher (Strange Loop 2022)43:04

"Stop Writing Dead Programs" by Jack Rusher (Strange Loop 2022)

Strange Loop Conference
468K views • 4 years ago
OCaml Workshop 2020 - State of the OCaml Platform 20201:00:01

OCaml Workshop 2020 - State of the OCaml Platform 2020

OCamlWorkshops
6K views • 6 years ago
Clojure for Lisp Programmers Part 1 - Rich Hickey1:28:59

Clojure for Lisp Programmers Part 1 - Rich Hickey

ClojureTV
25K views • 13 years ago
Condition Systems in an Exceptional Language - Chris Houser33:32

Condition Systems in an Exceptional Language - Chris Houser

ClojureTV
16K views • 10 years ago
Debugging with the Scientific Method - Stuart Halloway49:09

Debugging with the Scientific Method - Stuart Halloway

ClojureTV
25K views • 10 years ago
Symbolics Lisp Machine demo Jan 201313:43

Symbolics Lisp Machine demo Jan 2013

Kalman Reti
52K views • 13 years ago
Clojure for Java Programmers Part 1 - Rich Hickey1:48:13

Clojure for Java Programmers Part 1 - Rich Hickey

ClojureTV
131K views • 13 years ago
2018 LLVM Developers’ Meeting:  C. Schafmeister “Lessons Learned Implementing Common Lisp with LLVM”26:01

2018 LLVM Developers’ Meeting: C. Schafmeister “Lessons Learned Implementing Common Lisp with LLVM”

LLVM
61K views • 7 years ago
Lecture 7A | MIT 6.001 Structure and Interpretation, 19861:24:38

Lecture 7A | MIT 6.001 Structure and Interpretation, 1986

MIT OpenCourseWare
35K views • 17 years ago
Lisp Editing in the 80s - Interlisp SEdit4:54

Lisp Editing in the 80s - Interlisp SEdit

thoughtupquick
9K views • 9 years ago
Clojure in a nutshell by James Trunk32:44

Clojure in a nutshell by James Trunk

Func Prog Sweden
104K views • 5 years ago
Solid Ground // Saša Jurić35:15

Solid Ground // Saša Jurić

EMPEX Conference
14K views • 9 years ago
REBL - Stuart Halloway33:06

REBL - Stuart Halloway

ClojureTV
25K views • 7 years ago
Barliman: trying the halting problem backwards, blindfolded - William Byrd, Greg Rosenblatt36:14

Barliman: trying the halting problem backwards, blindfolded - William Byrd, Greg Rosenblatt

ClojureTV
8K views • 9 years ago
"Controlling Time and Space: understanding the many formulations of FRP" by Evan Czaplicki40:55

"Controlling Time and Space: understanding the many formulations of FRP" by Evan Czaplicki

Strange Loop Conference
69K views • 12 years ago
Solving Problems the Clojure Way - Rafal Dittwald1:02:26

Solving Problems the Clojure Way - Rafal Dittwald

Clojure/north
87K views • 7 years ago