News for hackers. Stuff that matters.
Re:What's a condition system and why do you want one? by thurn on Thursday April 28, 2011 @06:12PM (#2495315)
Would this be pretty easy to implement in a language with first class functions (albeit with more boilerplate) just by keeping a list of functions to be invoked before raising an exception?
Re:What's a condition system and why do you want one? by rfk on Thursday April 28, 2011 @07:43PM (#2495641)
You can get most of the way there using such an approach, but it'll never feel quite "right" unless your language gives you lots of syntactic sugar to play with.

You've also got to be careful about how your handler stack interacts with threads and/or coroutines.

For an example that I think same up pretty well, but certainly not as elegant as the system built into lisp, check out my "withrestart" python module: https://github.com/rfk/withrestart

Re:What's a condition system and why do you want one? by sedachv on Friday April 29, 2011 @11:51AM (#2497786)
Yes, but you'd also need to fake dynamic scoping. Check out Red Daly's implementation of the CL condition system for JavaScript/Parenscript, it's only about 200 lines of code:

https://github.com/gonzojive/paren-psos/commit/6578ad223515d...