On Fri 05 Feb 2016 10:26, l...@gnu.org (Ludovic Courtès) writes: > Federico Beffa <be...@ieee.org> skribis: > >> I've been playing a little bit with MIT Scheme and have noticed a very >> nice feature of the debugger: when you hit an error and enter the >> debugger, it allows you to continue execution of a program with a user >> supplied value (restarts). >> >> Looking for such a feature in Guile I've found this old thread: >> >> https://lists.gnu.org/archive/html/guile-user/2011-10/msg00033.html >> >> which suggests that it isn't. I'm wondering if something has moved in >> that direction since then. > > Sorry for the laaate reply! Unfortunately no, nothing has been done in > that direction, but it’d still be a welcome addition! > > Currently the behavior of ‘throw’ (in boot-9.scm) is that it always > aborts to the catch prompt and runs the ‘throw’ handler from there; the > continuation of the faulty code is not captured, and thus cannot be > resumed like MIT Scheme’s (restart 2) does: [...] > We would need to make this customizable. However, we don’t want to > systematically reify ‘cont’ here because that would be too costly. > > I’m not sure how to approach this. Maybe Andy or Mark know better?
I think in general we should not make a change that would allow any `throw' to return directly. That would break programs. However something like: (define %exits (make-parameter '())) (define-syntax-rule (with-exits name body ...) (let/ec exit (parameterize ((%exits (acons name exit (%exits)))) body ...))) and the debugger knows to look in %exits for potential exits -- that can work fine too. Or the debugger can know how to re-call a procedure with new arguments or something... Andy