Any chance that could make it in as a DrRacket feature?  Seems likely to have 
moderately broad utility.

Out of curiosity, what programming environment do the core Racket devs use when 
programming Racket?  I quite like DrRacket for my projects that are only a few 
files, but it doesn't seem to be aimed at large scale work.

-----Original Message-----
From: Matthew Flatt [mailto:mfl...@cs.utah.edu] 
Sent: Monday, July 27, 2015 2:43 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] continuing after a user break

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.

Reply via email to