[cl-walker-devel] [delico] Persistency with restart-case/handler-case/restart-bind/handler-bind

Thomas Karolski thomas.karolski at googlemail.com
Wed May 12 15:12:29 UTC 2010


Hi,

I was trying to get persistent continuations using hu.dwim.delico,
alas it turns out to be troublesome since SBCL internally uses
closures to achieve this.
Since most of the condition system commands are macros, I'd like to
know whether it is possible to write custom macros for the walker
which try not to depend on closures.

I've tried the following examples:
(defun/cc test/restarts/2 ()
  "Not persistent. But restarts. Closure somewhere."
  (restart-case
      (progn
        (yield 'eatin)
        (error "No more to eat!"))
    (stop-eatin ()
      :report "Stop eating and end script"
      nil)))

(defun/cc test/restarts/4 ()
  "Persistent. But restart not registered."
  (restart-case
      (with-call/cc
        (yield 'eatin)
        (error "No more to eat!"))
    (stop-eatin ()
      :report "Stop eating and end script"
      nil)))

(defun test/restarts/6 ()
  "Persistent. But restarts not working. Probably because the
with-call/cc lexical environment has the old restarts bound."
  (restart-case
      (with-call/cc
        (yield)
        (yield)
        (error "blaa2"))
    (return-with-nil () nil)))

(defun test/restarts/7 ()
  "Persistent, but handler not working."
  (handler-case
      (with-call/cc
        (yield)
        (yield)
        (error "blaa2"))
    (error () nil)))

(defun/cc test/restarts/8 ()
  "Persistent, but handler not working."
  (handler-case
      (with-call/cc ;; if progn here: no persistency
        (yield)
        (yield)
        (error "blaa2"))
    (error () nil)))




More information about the cl-walker-devel mailing list