At Mon, 27 Jul 2015 19:32:32 +0000, John Carmack wrote: > Is it possible to continue execution after a ^b user break in DrRacket (not > debugging)? It would often be useful to be able to ^b, print some global > state, set some flags, and continue running.
The `exn:break` exception record includes a `continuation` field. An exception handler can apply that continuation to resume from the point of the break. A significant limitation is that the handler has to be installed with `call-with-continuation-handler` or `uncaught-exception-handler`. If any `with-handlers` is in effect, it will catch any continuation and escape to the `with-handlers` form, at which point the continuation in `exn:break` cannot be applied (because it's an escape-only continuation). ---------------------------------------- #lang racket (let ([orig (uncaught-exception-handler)]) (uncaught-exception-handler (lambda (exn) (if (exn:break? exn) (begin (printf "continuing...\n") ((exn:break-continuation exn))) (orig exn))))) (let loop () (loop)) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.