Demonstrates the use of Racket's custodians and namespaces to create enough isolation to "reboot" programs without restarting the whole of Racket, including possibly recompiling and reloading code.
To experiment with this:
$ racket ~/src/racket-experiments$ racket Welcome to Racket v22.214.171.124. -> (require "reloader.rkt") -> (load-and-foo) Starting worker... test-mod: "foo" other-mod: "foo" other-mod: "foo" other-mod: "foo" other-mod: "foo" Terminating worker... ->
Subsequent runs of
(load-and-foo) will reload the code from scratch. If you've edited one of
other-mod.rkt in the meantime, the changes will show up.
other-mod.rkt runs a loop "forever", but that
reloader.rkt terminates all threads in the nested custodian.
This is wonderful.
I have one problem when test-mod.rkt requires racket/gui instead of racket/base:
cannot instantiate `racket/gui/base' a second time in the same process
By any chance, would you know how to solve this issue?