Skip to content
0:00 / 0:00

#commonlisp#slime#emacs

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

vindarel

590 subscribers • 1 video on Hallway

YouTube
  • Recommended by 1 person: 1 on Hacker News.
  • Presented by vindarel
  • Linked in the descriptionlem-project/lem

Intermediate. Assumes working knowledge.

5.3K views3 years ago1 recommendation

Programming languagesTools and practiceLisp and ClojureDebugging

vindarel demonstrates how to fix a bug, recompile a single function, and resume execution from the failed stack frame in Common Lisp.

We show how to fix a bug, re-compile ONE function and resume execution from where it failed. An extremely useful lesser known Common Lisp feature. We do all that while the program is still running and we avoid re-running long computations. 🚀 🎦 To learn Common Lisp efficiently and use it for decades, check-out my course: udemy.com/course/common-lisp-programming/?referralCode=2F3D6… It is packed with useful real-world stuff I learned the hard way that I make easily accessible for you. Notice: not for total programming beginners. ⭐ 🎄 🎁 ✨ Use this DECEMBER, 2022 COUPON: LISPY-XMAS-2022 *** We demo inside Emacs and Slime and then with the Lem editor: - github.com/lem-project/lem/ We write with hilight-trail-mode, we code with the modus-operandi theme. For more, see: - lispcookbook.github.io/cl-cookbook/debugging.html - where I contribute a lot. A perfect companion to my video course. - lisp-journey.gitlab.io --- Music credit: Workout by Brian Holtz Music Free download: filmmusic.io/song/8600-workout License (CC BY 4.0): filmmusic.io/standard-license Artist website: brianholtzmusic.com Favorite by Alexander Nakarada Free download: filmmusic.io/song/4855-favorite License (CC BY 4.0): filmmusic.io/standard-license Artist website: serpentsoundstudios.com/ Sound credit: freesound.org: Birds chipping by taavhaap, wing flaps by TRP. freesoundslibrary.com: typewriter by Spanac. Software: Kdenlive --- #lisp #programming #debugtips #debugging #common_lisp #emacs

Why it's here

1 person recommends this

What people say. Recommended as a compelling demonstration of Common Lisp's interactive debugging and image-based development capabilities.

vindarelon Hacker News • Recommends

On “Interactive Common Lisp Development”

To really discover what interactive, image-based CL development is about, my pointers: - link to 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…

vindarelon Hacker News • Mentions

On “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 link to this video and some more: link

vindarelon Hacker News • Mentions

On “Why Lisp?”

…he 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: link to this video not with unit tests, it's an example on how to restart a precise frame, how to avoid re-running everything.…

vindarelon Hacker News • Mentions

On “It's 2023, so of course I'm learning Common Lisp”

…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: link to 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), an…

vindarelon Hacker News • Mentions

On “Spinneret: A modern Common Lisp HTML generator”

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

vindarelon Hacker News • Mentions

On “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. link to this video

vindarelon Hacker News • Mentions

On “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: link to this video so we don't re-run everything from zero.

vindarelon Hacker News • Mentions

On “A Road to Common Lisp (2018)”

…ine ("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: link to 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.…

vindarelon Hacker News • Mentions

On “Ask HN: 30y After 'On Lisp', PAIP etc., Is Lisp Still "Beating the Averages"?”

…w 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: link to this video 2: link…

skydhashon Hacker News • Mentions

On “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: link to this video

trealiraon Hacker News • Mentions

On “The plan-execute pattern”

…of variables live, and then let the code run again. This0 is a clear explanation that I found. There's also a video1 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: link to this video…

vindarelon Hacker News • Mentions

On “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, i…