Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the recursive-restart Reference Manual, version 1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:45:40 2022 GMT+0.
Next: Systems, Previous: The recursive-restart Reference Manual, Up: The recursive-restart Reference Manual [Contents][Index]
Implements several forms for using restarts recursively. The first is recursive-restart-case
, which
works exactly like CL's native restart-case
, except you can invoke the restarts from the restart
handlers in a mutually-recursive fashion, such as this:
(let ((invoked-bar nil))
(recursive-restart-case
(invoke-restart 'foo)
(foo ()
(format t "Invoked FOO.~%")
(if invoked-bar
:done
(invoke-restart 'bar)))
(bar ()
(format t "Invoked BAR.~%")
(setf invoked-bar t)
(format t "Invoking FOO again...~%")
(invoke-restart 'foo))))
Also provided is restart-labels
, which is a wrapper macro that allows you to specify the handlers
before the body, which gains an implicit PROGN. The syntax mirrors that of CL's labels
form:
(restart-labels
((foo () (format t "Invoked FOO.~%"))
(bar () (format t "Invoked BAR.~%")))
(format t "Starting body...~%")
(invoke-restart 'foo))
restart-bind*
is to restart-labels
as let*
is to let
, ie, each handler is wrapped in a new recursive-restart-case
.
Next: Files, Previous: Introduction, Up: The recursive-restart Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Restarts that can invoke themselves.
Jeremy Phelps
Jeremy Phelps
MIT
Restarts that can invoke themselves.
1
alexandria (system).
recursive-restart.lisp (file).
Next: Packages, Previous: Systems, Up: The recursive-restart Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: recursive-restart/recursive-restart.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
recursive-restart (system).
Previous: recursive-restart/recursive-restart.asd, Up: Lisp [Contents][Index]
recursive-restart (system).
restart-labels (macro).
Next: Definitions, Previous: Files, Up: The recursive-restart Reference Manual [Contents][Index]
Packages are listed by definition order.
restart-labels (macro).
Next: Indexes, Previous: Packages, Up: The recursive-restart Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Previous: Public Interface, Up: Public Interface [Contents][Index]
A construct that, after a restart is invoked, it jumps to the start and reevaluate
the body by default. Example:
(do-restart ((retry (lambda (c) (print :retry)))
(continue (lambda (c) (print :retry))))
(error "error!"))
Analogous to the relation between let and let*.
In standard handler-bind, the execution of the handler is
’run in a dynamic environment where none of these handler bindings are visible (to
avoid recursive errors).’
– (http://www.lispworks.com/documentation/HyperSpec/Body/m_handle.htm)
(handler-bind* ((error (lambda (c) (print :error)))
(my-error (lambda (c) (print :my) (signal c))))
(error ’my-error))
The variation of handler-case whose behavior is the same but
the semantics are that of HANDLER-BIND.
Just as HANDLER-CASE, the condition is handled first (that is, it jumps
out of the HANDLER-BIND scope with GO) and then
the handler function is called. Finally, HANDLER-RETURN returns
the value of the handler function. Example:
(restart-return ((retry (lambda (c) (print :retry)))
(continue (lambda (c) (print :retry))))
(error "error!"))
is equivalent to:
(restart-case
(error "error!")
(retry (c) (print :retry))
(continue (c) (print :retry)))
RECURSIVE-RESTART-CASE has the same semantics as RESTART-CASE, except
you can re-invoke any of the restarts in a mutually recursive fashion.
Example:
(let ((invoked-bar nil))
(recursive-restart-case
(invoke-restart ’foo)
(foo ()
(format t "Invoked FOO.~%")
(if invoked-bar
:done
(invoke-restart ’bar)))
(bar ()
(format t "Invoked BAR.~%")
(setf invoked-bar t)
(format t "Invoking FOO again...~%")
(invoke-restart ’foo))))
Analogous to the relation between let and let*.
(restart-bind* ((retry (lambda (c) (invoke-restart ’continue)))
(continue (lambda (c) (print :retry))))
(error "error!"))
The variation of restart-case whose behavior is the same but
the semantics are that of RESTART-BIND.
Just as RESTART-CASE, the condition is handled first (that is, it jumps
out of the RESTART-BIND scope with GO) and then
the restart function is called. Finally, RESTART-RETURN returns
the value of restart function.
Previous: Public Interface, Up: Definitions [Contents][Index]
Previous: Definitions, Up: The recursive-restart Reference Manual [Contents][Index]
Jump to: | D H M R |
---|
Jump to: | D H M R |
---|
Jump to: | F P R S |
---|
Jump to: | F P R S |
---|