Hi - <br><br>Is it possible to handle exceptions like Common Lisp, specifically restarts? <br><br>Scenario: undefined variables - handling by defining the variable, and continue past the exception.<br><br>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... <br>
<br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">;; x is undefined - provide it with #<undefined> and continue<br>(with-handlers ((exn:fail:contract:variable? </span><br><span style="font-family: courier new,monospace;"> (lambda (e) </span><br>
<span style="font-family: courier new,monospace;"> (<b>use-value</b> (letrec ((x x)) x)))) ;; supply x with the value of undefined</span> <br><span style="font-family: courier new,monospace;"> (eval `(display x)))<br>
;; prints #<undefined> </span> <br></div><br>I found in manual that exceptions are marked with barriers and may not be crossable, so not sure if the above is achievable. <br><br>Any pointers are appreciated, thanks,<br>
yc<br><br>