Re:Beyond Exception Handling: Conditions and Restarts
by awj on Monday November 14, 2011 @12:37PM
(#3234846)
This is the one feature I wish I could steal from Common Lisp in almost every language I work with. It would be much easier to put in than almost any other big lisp feature, and damn would it make a lot of things easier.
[ Parent
| on HN ]
Re:Beyond Exception Handling: Conditions and Restarts
by sedachv on Monday November 14, 2011 @01:57PM
(#3235175)
This is something you can do in most languages if all the code that needs restarts follows a convention/protocol. Red Daly implemented CL condition handling for JavaScript for the Parenscript CL-to-JS compiler: https://github.com/gonzojive/paren-psos/commit/6578ad223515d...
The compiled CL code knows about the convention and follows it, but other JavaScript code doesn't and isn't affected by it.
Re:Beyond Exception Handling: Conditions and Restarts
by awj on Monday November 14, 2011 @03:46PM
(#3235624)
Yeah, that's why I talk about stealing it at the language level. Although it's possible to use this based on conventions, the real power comes from being able to use it to cover weird conditions while gluing various libraries together. If your language already has a relatively similar tool (i.e. "traditional" exceptions) there's basically no chance that anything you pick up will support conditions.
That said, it's a wonderful model to know about/follow if you come into the rare case that makes reimplementing it where you can useful.
Re:Beyond Exception Handling: Conditions and Restarts
by sedachv on Tuesday November 15, 2011 @04:22PM
(#3240302)
This is true for Common Lisp libraries as well - if they don't offer restarts and just throw exceptions, it looks like it does in any other language. Developing a good protocol for signalling and handling errors takes work.