5 ms·
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
by awj 15y ago
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.
- sedachv 15y agoThis 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/6578ad223515dc2c1ddf49346f4baf7c3bee37c4 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.
- awj 15y agoYeah, 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.
- sedachv 15y agoThis 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.