[Ecls-list] unbound-variable handler

Pierre THIERRY nowhere.man at levallois.eu.org
Tue Jun 19 00:53:48 UTC 2007


Scribit Dean O'Connor dies 19/06/2007 hora 03:03:
> I am trying to setup a handler to catch "unbound-variable".

The thing is, if I understand the condition system correctly, you need
to setup a restart around the expression that might be unbound:

(handler-bind
    ((unbound-variable (lambda (c)
			 (declare (ignore c))
			 (invoke-restart 'use-nil))))
  (not (restart-case
	   not-yet-bound-variable
	 (use-nil () nil))))

Works in SBCL and ECL (yields t).

Quickly,
Pierre
-- 
nowhere.man at levallois.eu.org
OpenPGP 0xD9D50D8A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20070619/044289ad/attachment.sig>


More information about the ecl-devel mailing list