[racket] REPL @ Runtime Contract Modification?
At Thu, 27 Jun 2013 12:35:10 -0400, Sean Kanaley wrote:
> As a more general solution to this kind of interactive debugging issue,
> how difficult would implementing a typical Common Lisp REPL be? I'm
> thinking of adding the kind of error/condition handler like:
>
> "<error or condition goes here>
>
> enter a number:
>
> 0 - enter new value
> 1 - exit to top level
> 2 - exit one level
> 3 - print stack trace
> 4 - etc.
>
> I'm not familiar with Racket's internals so I don't know how much this
> is a REPL hack vs. rewriting the whole system (the condition system
> isn't necessary)... If it's not too impossible I would be happy to make
> this contribution...
Racket's implementation (and maybe to some degree, I think, its design)
does not support restartable exceptions, except in the case of the
`exn:break' exception. So, option 0 would be difficult or impossible to
implement as a hook into the run-time system.
A debugger could instrument programs to allow this kind of restart by
wrapping every expression with a prompt, but I think that would be
fairly expensive in the current implementation.