[Ecls-list] unbound-variable handler

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Thu Jul 12 08:28:18 UTC 2007

2007/6/25, Dustin Long <dlong at stevens.edu>:
> That would be cell-error-name
> (handler-bind
>     ((unbound-variable
>       (lambda (e)
>         (format t "unbound var ~s~%" (cell-error-name e))
>         (invoke-restart 'use-value nil))))
>     (format t "value is [~s]~%" x))
> cell-error-name also works in ECL, it's only the restart that doesn't. I
> really feel that deserves a patch. Not sure I'll have time to look into
> it myself, though.

The issue is more complicated than what you think. First of all note
that SBCL and CMUCL have a similar behavior: they provide no default
restarts for this kind of value.

Second, imagine that an implementation provides default restarts to
any kind it thinks of. For those restarts to be useful, they typically
have to be set up around the point where the error happens. That means
they will overwrite all restarts you set up. This code, for instance,
will not work

(restart-case (eval '*a*)
   (use-value ... ))

where ... is what you want to do with the value.

I really would like to get it right, but not at the expense of
limiting the implementation.


Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)

More information about the ecl-devel mailing list