5 ms·
Detecting non-local exits in Common Lisp
- pfdietz 5y agoLink did not work, maybe this was meant? https://mov.im/?blog/phoe%40movim.eu/detecting-non-local-exits-in-common-lisp-2QAoHy https://mov.im/?blog/phoe%40movim.eu/detecting-non-local-exi...
- dang 5y agoIt's because mov.im is giving us a 302 with redirect to https://mov.im/?notfound https://mov.im/?notfound. Does anybody know if this is intentional? or who we can get in touch with to fix this? The same problem happened with https://news.ycombinator.com/item?id=29891523 https://news.ycombinator.com/item?id=29891523 too. These are good posts, and I'd like to fix this problem.
- CapitalistCartr 5y agoI followed a link from http://planet.lisp.org/ http://planet.lisp.org/ to it, which still works. When I posted this, I tested the link (of course) and it worked for me, but now it doesn't. Edit: If I cut and paste the link from Planet Lisp, it works, but from here, they don't like us.
- kazinator 5y agoThis is mostly a bad idea. (defun oblivion (thunk) (let ((successfulp nil)) (unwind-protect (multiple-value-prog1 (funcall thunk) (setf successfulp t)) (unless successfulp (error "STOP RIGHT THERE CRIMINAL SCUM"))))) Supose (funcall thunk) signaled a very well thought-out error, filled with useful information. The error found a handler somewhere, and that handler found the perfect place to transfer control to. But, oops, you hamfistedly intervened in that, and replaced that with your generic error. You sometimes need let over unwind-protect not to throw an error, but to know whether or not to clean something up. (defun do-it (handle) (let ((transaction-completed nil)) (unwind-protect (progn (prepare-transaction handle) (commit-transaction handle) (setf transaction-completed t)) (unless transaction-completed (roll-back handle))))) The cleanup handlers of an unwind-protect always execute. But you don't always need them to do their clean-up. In this case, we want to abort the partially done transaction, but avoid doing so in the happy case. I think this makes for a better illustration of why you're sometimes only interested in the non-local exit.