I've been reading the excellent book by Peter Seibel Practical Common Lisp in order to address some research I've been doing related with the Common Lisp error handling system.
Although I have read the explanation in the book and tried to dig some information in the net I have been not capable of understand the meaning and the usage of the STORE-VALUE
and USE-VALUE
restarts. Can someone explain what is the purpose of these functions?
;;; Example of the STORE-VALUE and USE-VALUE restarts
(defun careful-symbol-value (symbol)
(check-type symbol symbol)
(restart-case (if (boundp symbol)
(return-from careful-symbol-value
(symbol-value symbol))
(error 'unbound-variable
:name symbol))
(use-value (value)
:report "Specify a value to use this time."
value)
(store-value (value)
:report "Specify a value to store and use in the future."
(setf (symbol-value symbol) value))))