News for hackers. Stuff that matters.
Re:The Common Lisp Condition System – Upcoming Book by tester34 on Wednesday July 15, 2020 @08:40AM (#23844315)
During debugging, yea?
Re:The Common Lisp Condition System – Upcoming Book by aidenn0 on Wednesday July 15, 2020 @09:50AM (#23845173)
For this example, it would be during debugging. You could intentionally write a bug, and then write a condition handler that would fix the bug without unwinding the stack further than necessary, but that would be rather pointless.

However think of all the things that can go wrong with your environment that don't involve a bug in your program. A network connection goes down, the disk gets full, &c. All of those can be handled without unwinding the stack to the point where the code for handling them was defined.

For a really trivial example, consider a performance watchdog. If you want to completely abort the attempt and log a call-stack, you can do that it just about any modern, dynamic language because the exception object includes the call-stack. But what if you want to log the call-stack and continue for the first N times the watchdog rolls-over? This is, of course, doable in other languages with passing callbacks and such, but in Lisp this can be done by signalling a condition in the exact same manner that an exceptional condition would be signaled.

I'm excited about this book, because that particular feature is underutilized in Lisp (by myself included), probably because it's one of the last dynamic things that Lisp does that more well-known dynamic languages do not, so programmers coming from other languages just aren't going to use it.

Re:The Common Lisp Condition System – Upcoming Book by phoe-krk on Wednesday July 15, 2020 @10:13AM (#23845477)
> All of those can be handled without unwinding the stack to the point where the code for handling them was defined.

Nitpick: the only thing that cannot be handled by winding the stack is when you run out of stack to wind.

But, luckily, if your program overflows the stack, you usually have bigger issues to deal with and/or you usually have all the stack information you need to diagnose the problem.

Re:The Common Lisp Condition System – Upcoming Book by phoe-krk on Wednesday July 15, 2020 @08:42AM (#23844326)
Yes, all that without leaving the debugger. The debugger is left only when we want to continue execution of the program.
Re:The Common Lisp Condition System – Upcoming Book by protomyth on Wednesday July 15, 2020 @09:22AM (#23844816)
I've noticed quite a few Smalltalk programmers who actually coded in the debugger. They would put a call in the program, hit it as an error, and then write new code. Does this happen with Common Lisp programmers?
Re:The Common Lisp Condition System – Upcoming Book by p_l on Wednesday July 15, 2020 @11:15AM (#23846361)
I know of several lispers that swear by top-down "programming inside debugger", where they continuously fill in the gaps starting from top level function :-D
Re:The Common Lisp Condition System – Upcoming Book by phoe-krk on Wednesday July 15, 2020 @11:17AM (#23846402)
Do you have any videos of such programming style performed in Lisp, or could you try to convince some of those programmers to record some of their programming sessions?
Re:The Common Lisp Condition System – Upcoming Book by rags2riches on Wednesday July 15, 2020 @12:27PM (#23847544)
You could look up Baggers on Youtube for plenty of fun Lisp coding sessions.
Re:The Common Lisp Condition System – Upcoming Book by phoe-krk on Wednesday July 15, 2020 @12:36PM (#23847674)
I know Baggers and his videos but I wasn't aware that he does debugger-oriented programming. Thanks, I'll pay closer attention to them!
Re:The Common Lisp Condition System – Upcoming Book by phoe-krk on Wednesday July 15, 2020 @09:31AM (#23844943)
Smalltalk and Common Lisp are both image-based programming languages where the compiler and debugger are always available. I think debugger-oriented programming is much more common in Smalltalk than in Lisp (at least I prefer to leave the debugger back to REPL pretty often), but I think it's certainly possible to adopt. The Slime/Sly environments for emacs might accept a few patches to facilitate that programming style better.