Skip to content
0:00 / 0:00

#clojure#commonlisp#conditionsystem

Condition Systems in an Exceptional Language - Chris Houser

ClojureTV

111K subscribers • 158 videos on Hallway

YouTube
  • Recommended by 3 people: 1 on Hacker News, 1 in engineering communities and 1 curated list.
  • Presented by Chris Houser, co-author of The Joy of Clojure

Intermediate. Assumes working knowledge.

15K views10 years ago3 recommendations

Programming languagesSoftware designFunctional programmingLanguage design and type systemsLisp and Clojure

Chris Houser discusses why Clojure's exception handling destroys stack information and explores how to implement Common Lisp-style condition systems.

"Some errors, however, are sufficiently obscure to escape detection for a surprisingly long time." -Brooker and Wheeler, 1952 Clojure does not come with a Condition system as powerful as Common Lisp's. Instead, we have Exceptions, which start unwinding the stack the moment they're thrown, destroying information as they go. The values of locals disappear, and there is no ability to continue from the location of the error. Several libraries solve this problem, but they do not compose well with each other. We will discuss these libraries, how they work, and why they don't compose. We will consider alternatives that may compose better, and the tradeoffs and amongst all of these. About the speaker: Chris, a.k.a. Chouser, co-authored "The Joy of Clojure" and enjoys using Clojure regularly with the LonoCloud team at ViaSat.

Why it's here

3 people recommend this

What people say. Recommended as an excellent overview of the differences between standard exceptions and Common Lisp's resumable condition systems.

u/schauehoin r/Clojure • Recommends

Condition Systems in an Exceptional Language - Chris Houser

programming-talkscurated list on GitHubRecommends

Under “Clojure”

Condition Systems in an Exceptional Language 00:33:31 by **Chris Houser** (2015)

puredangeron Hacker News • Recommends

On “State of Clojure 2016 – Results and Analysis”

There are some libraries for this. A great overview of the problem and some of the libs is link to this video and a good set of corresponding notes at link

u/czanin r/Clojure • Mentions

On “Common Lisp Style Conditions+Restarts in Clojure”

How fun! I've done something like this before in my wingman library, although I didn't keep as closely to the Common Lisp spec, and I built mine on top of exceptions so it would play nicely with existing error handling. My idea was to make it possible for libraries to throw their exceptions as usual, but give them the capacity to add restarts for people who opted into using Wingman. In the end, though, I found the utility of Wingman wasn't really there. Using Chris Houser's dynamic variable approach is more lightweight when you only want this sort of control in code, so this sort of generic restart interface is most useful when the restarts can be used interactively. In that case it's har…

u/punkisdeadin r/Clojure • Mentions

On “[ANN] dont-give-up: Common Lisp style interactive restarts”

You might want to check out this talk that Chris Houser gave a few years ago. link to this video

u/MattDarlingin r/Clojure • Mentions

On “FYI: ClojureTV updated their channel today with Clojure/conj 2015 videos.”

Debugging with the Scientific Method by Stuart Halloway is *excellent*, and has basically nothing to do with Clojure, so anyone can benefit from it. It's my favourite thing from the Conj so far. If I was only picking three, my next two would be: * Condition Systems in an Exceptional Language by Chris Houser: how do you get flexibility in both how your program responds to errors, and how you handle those errors? * Improving Clojure's Error Messages with Grammars by Colin Fleming: tangential to the use case of improving error messages, this provides examples of how complicated macros could be written with parsers, which would make me personally far more likely to write non-trivial…

agumonkeyon Hacker News • Mentions

On “Java Exception Handling”

The stack unwinding was such a sad thing to me. Reading about CL condition system made me smile widely. You have more data to treat the exception. While reading the abstract, suddenly the word Exception felt absurd. It's rarely an exceptional condition, it's really a parallel planned error checking. Also, being from the Java era, an Exception was mostly a boring way to ensure error checking, while lispers did use exception as cut / tree jmp to provide solution values to an algorithm. ps: funny today youtube suggested this link to this video

nialoon Hacker News • Mentions

On “Why Clojure? (2010)”

It turns out that it is, in fact, at least mostly possible to implement a condition type system in Clojure. See link to this video I did a little bit of googling for Clojure libraries that do this: link and link I don't actually recommend any of these and haven't tried them. In particular I think using a non-standard library for your error handling, which is already probably relatively poorly tested, is probably a bad idea. I just wanted to point out that it's possible. I also think I remember something in a Rich Hickey talk (maybe "Clojure for Lisp Programmers"?) where someone in the audience asks about condition systems, and he responds that Clojure doesn't have one, but that it should be possibl…

phyrexon Hacker News • Mentions

On “Clojure 1.10 release”

You can do that yourself if you care ( link to this video ) but I get what you mean. On the other hand, on a server application a REPL on exception wouldn’t help me.

the-alchemiston Hacker News • Mentions

On “What makes a good REPL? (2017)”

True, the CL REPL is more useful than the Clojure REPL, but CL has a 20-30 year head start in development. Plus, Clojure was developed as a hosted language, and runs on .NET, Javascript, JVM, and even Dart (in-progress). Since exceptions are quite deeply integrated into those platforms (as opposed to conditions), it has "bled through" to the Clojure APIs, and, in turn, REPL. Folks have written a CL-style condition/restart library for Clojure ( link ) too. link to this video video too.

u/ventuspilotin r/ProgrammingLanguages • Mentions

On “Alternative to try/catch”

Lisp's condition system is a lot more flexible than try/catch, the biggest difference seems to be that with a Java style try/catch the exception handler runs after the stack is unwound while in Lisp it runs before unwinding (and can therefore actually fix things and continue). link to this video explains Lisp's condition system which you may find interesting. I think some of the concepts could be implemented in other languages as well.

u/WalterGRin r/Clojure • Mentions

On “[ANN] dont-give-up: Common Lisp style interactive restarts”

> You might want to check out this talk that Chris Houser gave a few years ago. link to this video To save people a click: Condition Systems in an Exceptional Language - Chris Houser Length: 33m31s Published by: ClojureTV Published on: Nov 17, 2015 "Some errors, however, are sufficiently obscure to escape detection for a surprisingly long time." -Brooker and Wheeler, 1952 Clojure does not come with a Condition system as powerful as Common Lisp's. Instead, we have Exceptions, which start unwinding the stack the moment they're thrown, destroying information as they go. The values of locals disappear, and there is no ability to continue from the location of the error. Several libraries solve this p…

u/beppuin r/Clojure • Mentions

On “New Clojurians: Ask Anything”

**I do wish there were a blessed library for conditions.** Summary of video: Many condition systems for Clojure have been written by 3rd parties. Unfortunately, they may be mutually incompatible with each other. However, it is possible to get the benefits of a condition system through creative use of dynamic variables without having to use any library. ---- It would be nice if a blessed condition system existed so that people could start standardizing on it. My favorite one is **hara.event**, but anything that did the job and received the blessing of Clojure's core developers would be sufficient.