3 ms·
Can somebody please also elaborate what is the difference between condition system in CL and "new thing" algebraic effect handlers? On the surface I see no diff
by artemonster 7y ago
Can somebody please also elaborate what is the difference between condition system in CL and "new thing" algebraic effect handlers? On the surface I see no difference, other that the latter is being a more formalized version of conditions?
But we have same properties: 1. signal a condition to some handler(s), possibly with value. 2. reify the stack into a (delimited up to level with handler) continuation and let handler decide what to do with it: save, restart, resume with some value. Am I missing something?
- dfox 7y agoThe CL condition system is completely orthogonal to any concept of continuations or stack unwinding. Both condition handlers and restarts are plain functions and any kind of stack unwinding has to be implemented inside these functions (by means of TAGBODY/GO, BLOCK/RETURN-FROM or THROW/CATCH).
- hencq 7y agoTo add to that, as an example, here's how you could implement something similar in Clojure [1]. It just relies on dynamic scope to run the handler without unwinding the stack. [1] https://gist.github.com/msgodf/6f4e43c112b8e89eee3d https://gist.github.com/msgodf/6f4e43c112b8e89eee3d
- lilactown 7y agowhat's the difference from what you said (handlers and restarts are functions) vs. a continuation, which could ostensibly just be a function that has closed over the state of the runtime before the condition was triggered?
- lilactown 7y agoAFAICT Algebraic Effects are a way of encoding conditions into a static type system. The idea of signaling a condition and passing a continuation is not the new part (as you've noted), it's the _algebra_ part, where a type system can check at compile time that these conditions that a piece of code calls are implemented by the context it is called in.
- artemonster 7y agothank you!