# Addendum about what new this can do

Gamedev of the ages and lisp schemer [mdhughes.tech](https://mdhughes.tech) said this was a pretty clear example of conditions but asks *what can they do that function calls can not*.

This is a point Kent Pitman also made about my simple examples, that if all you are doing is basically making a function call, the correct thing to do would be to instead just make a function call.

## An `impossible-example`
Edit: Forgot example rnuning
```
IMPOSSIBLE-EXAMPLE
CL-USER> (handler-bind ((retrieve #'handle-directory)
	       (retrieve #'opposite-day)
	       (retrieve #'handle-file)
	       (t #'error))
  (impossible-example))
rab
oof
"rab
oof"
```

We introduce an `opposite-day` handler in which a file's text is reversed iff `*opposite-day*` is true and the reversed text is given to a restart named `file` if it is available on the condition being handled.

Then we define a function `impossible-example` that `signal`s to `retrieve` an `item`.

We then call `impossible-example` inside a `handler-bind` where `opposite-day` can accept a `retrieve` signal.

*This is impossible* lexically, because `opposite-day` does not have and has not had lexical access to the `file` restart which it accesses by computing restarts (in this case by `find-restart`) available on the `retrieve` condition it handles.

```
(defparameter *opposite-day* t)

(defun opposite-day (c)
  (unless (and *opposite-day*
	       (typep c 'retrieve)
	       (slot-boundp c 'item))
    (return-from opposite-day))

  (let* ((meti (reverse (format nil "~a" (item c))))
	 (r (find-restart 'file c)))
    (when
	r
      (invoke-restart r meti))))

(defun impossible-example ()
  (handler-bind
      ((got-request-for #'handle-got-request))
    (as-gopher () ()
      (signal 'retrieve :item "foo
bar"))))

(handler-bind ((retrieve #'handle-directory)
	       (retrieve #'opposite-day)
	       (retrieve #'handle-file)
	       (t #'error))
  (impossible-example))
```

Hopefully I got that right!

Mastodon thread: https://gamerplus.org/@mdhughes@appdot.net/116079791969629546