3 ms·
Interesting. This looks like an implementation of the abstract computer science notion of continuations (https://en.wikipedia.org/wiki/Continuation); https://en
by shadowgovt 7y ago
Interesting. This looks like an implementation of the abstract computer science notion of continuations (https://en.wikipedia.org/wiki/Continuation); https://en.wikipedia.org/wiki/Continuation); neat to see them used this way.
- ska 7y agoIt's really orthogonal to continuations. Scheme has them (continuations) explicitly. CL chose not to, I think for performance reasons if I recall correctly.
- phoe-krk 7y agoThe Common Lisp condition system is actually just a dynamically-scoped hook system. Handlers are the actual hooks; conditions are the object that may trigger some of the hooks when they are signaled. Restarts are an addition on top of the hooks that allows for easier non-local transfer of control; they provide little that handlers do not provide unless you count the Lisp debugger - by design, the only way to leave the debugger is by using a restart. In other words: no continuations here.
- shadowgovt 7y agoInteresting. I'm not sure I understand; what do the dynamically-scoped hooks lack that continuations would give you?
- phoe-krk 7y agoTo be frank, I do not know. I am not a continuation specialist or even an adept, so I cannot say myself; all I can say for sure is that a condition system can be implemented (and is actually implemented in practice) without any continuations, and therefore doesn't require the underlying language to support continuations. (Common Lisp, for example, purposefully doesn't have them in standard - see http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuations-original.html. http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuat...)
- sedachv 7y agoIn Common Lisp, you can only transfer control up the stack. With continuations, you get multiple stacks that you can transfer control between.