[plt-scheme] restart exception handling?

From: YC (yinso.chen at gmail.com)
Date: Thu Jul 10 17:35:57 EDT 2008

Hi -

Is it possible to handle exceptions like Common Lisp, specifically
restarts?

Scenario: undefined variables - handling by defining the variable, and
continue past the exception.

It's unclear to me how to write the following code - I assume it requires
continuations and continuation-marks in the exception, but I know very
little about the topic...

;; x is undefined - provide it with #<undefined> and continue
(with-handlers ((exn:fail:contract:variable?
                (lambda (e)
                   (*use-value* (letrec ((x x)) x)))) ;; supply x with the
value of undefined
  (eval `(display x)))
;; prints #<undefined>

I found in manual that exceptions are marked with barriers and may not be
crossable, so not sure if the above is achievable.

Any pointers are appreciated, thanks,
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080710/7e8358a9/attachment.html>

Posted on the users mailing list.