Skip to content
0:00 / 0:00

#clojure#commonlisp#conditionsystem

Condition Systems in an Exceptional Language - Chris Houser

ClojureTV

111K subscribers • 136 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

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.