The recursive-restart Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The recursive-restart Reference Manual

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.

Table of Contents


1 Introduction

recursive-restart

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.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 recursive-restart

Restarts that can invoke themselves.

Maintainer

Jeremy Phelps

Author

Jeremy Phelps

License

MIT

Long Description

Restarts that can invoke themselves.

Version

1

Dependency

alexandria (system).

Source

recursive-restart.asd.

Child Component

recursive-restart.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


3.1.1 recursive-restart/recursive-restart.asd

Source

recursive-restart.asd.

Parent Component

recursive-restart (system).

ASDF Systems

recursive-restart.


3.1.2 recursive-restart/recursive-restart.lisp

Source

recursive-restart.asd.

Parent Component

recursive-restart (system).

Packages

recursive-restart.

Public Interface
Internals

restart-labels (macro).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 recursive-restart

Source

recursive-restart.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

restart-labels (macro).


5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: do-restart (bindings &body body)

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!"))

Package

recursive-restart.

Source

recursive-restart.lisp.

Macro: handler-bind* (bindings &body body)

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))

Package

recursive-restart.

Source

recursive-restart.lisp.

Macro: handler-return (bindings &body body)

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)))

Package

recursive-restart.

Source

recursive-restart.lisp.

Macro: recursive-restart-case (value-form &rest cases)

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))))

Package

recursive-restart.

Source

recursive-restart.lisp.

Macro: restart-bind* (bindings &body body)

Analogous to the relation between let and let*.

(restart-bind* ((retry (lambda (c) (invoke-restart ’continue))) (continue (lambda (c) (print :retry))))
(error "error!"))

Package

recursive-restart.

Source

recursive-restart.lisp.

Macro: restart-return (bindings &body body)

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.

Package

recursive-restart.

Source

recursive-restart.lisp.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Macros

Macro: restart-labels (bindings &body body)
Package

recursive-restart.

Source

recursive-restart.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables