[racket] instantiating multiple sandboxes with gui's

From: Greg Hendershott (greghendershott at gmail.com)
Date: Sun Apr 6 11:29:23 EDT 2014

For those following along at home, I just pushed to `experimental`
branch an updated strategy:

https://github.com/greghendershott/racket-mode/commit/0358c0248a062245c134c48053aed79298a71c3a

"When racket/gui/base not already loaded, examine the user module we're
about to load to see if it will require racket/gui/base. If so,
dynamic-require racket/gui/base on our main custodian. Then switch to
user custodian and dynamic-require the module as usual. That way, we can
do a custodian-shutdown-all on the user custodian, while leaving intact
the main eventspace defined by racket/gui/base."


How to "examine the user module we're about to load to see if it will
require racket/gui/base"? Following the example of how syntax/moddeps
works, recursively exploring using module-compiled-imports. (And
memoizing, since there can easily be hundreds of imports to explore.)

In my limited set of tests, this works as-desired. Of course there
might be big holes in it I don't yet know about.

Posted on the users mailing list.