<HTML><BODY>In Common Lisp you have to use construction like<BR><BR>(restart-case <BR> (/ 1 x) <BR> (use-value (value) "" value)) <BR><BR>or cerror or something like that.<BR><BR>I don't see, what prevents Racket to do the same: restart-case capture continuations and handler-case, handler-bind or debugger choose the continuation.<BR><BR>Something like:<BR><BR>(define (test l) <BR> (if (null? l)<BR> '()<BR> (cons (let/cc k (with-handlers <BR> ([exn? (λ (v) (raise (cons v k)))]) <BR> (/ 1 (car l))))<BR> (test (cdr l)))))<BR><BR>Then debugger can catch the continuation and call (k new-value).<BR><BR><BR><BR><BR>Четверг, 27 июня 2013, 13:32 -06:00 от Matthew Flatt <mflatt@cs.utah.edu>:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #0857a6 1px solid; PADDING-BOTTOM: 0px; MARGIN: 10px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" class=mailru-blockquote>
<DIV>
<DIV class="js-helper js-readmsg-msg">
<STYLE type=text/css></STYLE>
<DIV id=style_13723616850000000757 class=mr_read__body><BASE href="https://e.mail.ru/" target=_self>
<DIV id=style_13723616850000000757_BODY>At Thu, 27 Jun 2013 12:35:10 -0400, Sean Kanaley wrote:<BR>> As a more general solution to this kind of interactive debugging issue, <BR>> how difficult would implementing a typical Common Lisp REPL be? I'm <BR>> thinking of adding the kind of error/condition handler like:<BR>> <BR>> "<error or condition goes here><BR>> <BR>> enter a number:<BR>> <BR>> 0 - enter new value<BR>> 1 - exit to top level<BR>> 2 - exit one level<BR>> 3 - print stack trace<BR>> 4 - etc.<BR>> <BR>> I'm not familiar with Racket's internals so I don't know how much this <BR>> is a REPL hack vs. rewriting the whole system (the condition system <BR>> isn't necessary)... If it's not too impossible I would be happy to make <BR>> this contribution...<BR><BR>Racket's implementation (and maybe to some degree, I think, its design)<BR>does not support restartable exceptions, except in the case of the<BR>`exn:break' exception. So, option 0 would be difficult or impossible to<BR>implement as a hook into the run-time system.<BR><BR>A debugger could instrument programs to allow this kind of restart by<BR>wrapping every expression with a prompt, but I think that would be<BR>fairly expensive in the current implementation.<BR><BR>____________________<BR> Racket Users list:<BR> <A href="http://lists.racket-lang.org/users" target=_blank>http://lists.racket-lang.org/users</A><BR></DIV><BASE href="https://e.mail.ru/" target=_self></DIV></DIV></DIV></BLOCKQUOTE><BR><BR>-- <BR>Roman Klochkov<BR></BODY></HTML>