[Openmcl-devel] INVOKE-RESTART bug

Gary Byers gb at clozure.com
Thu Jun 3 04:24:52 PDT 2010

The restart isn't applicable: when called with NIL as an argument, its
test function returns NIL.

INVOKE-RESTART is supposed to signal a CONTROL-ERROR if the restart
isn't valid.  Some implementations (LispWorks and SBCL) that I looked
at appear to consider inapplicable restarts to be valid; others (Allegro,
CLISP, and CCL) don't.  I lean towards believing that the latter interpretation
is correct (both because it's what I'm used to and because I find the concept
of "valid, but inapplicable restarts" a little hard to believe in), but the
language that the spec uses seems unfortunately vague.  (The term "valid restart"
doesn't seem to be defined anywhere; interpreting "valid restart" to mean "active,
though not necessarily applicable restart" isn't totally unreasonable, either.

The problem with that latter interpretation is that a test function has to
return T if called with NIL as an argument in order to be considered applicable.
(It's not clear that restart test functions that don't accept NIL are particularly
useful in that interpretation, but the somewhat awkward idiom:

  :test (lambda (c) (or (null c) (typep c 'some-condition)))

is likely necessary in practice, given that implementations behave differently
when the (NULL C) case returns false.

On Thu, 3 Jun 2010, Stelian Ionescu wrote:

> When a restart FOO has a non-trivial test,
> (invoke-restart (find-restart foo) won't work because invoke-restart
> calls the restart's test which will return NIL, and invoke-restart
> signals a "Restart ... is not active"
> Test case attached
> -- 
> Stelian Ionescu a.k.a. fe[nl]ix
> Quidquid latine dictum sit, altum videtur.
> http://common-lisp.net/project/iolib

More information about the Openmcl-devel mailing list