[racket] Auto reloading REPL?

From: Dennis Honeyman (arcticuno at gmail.com)
Date: Sun Jan 15 18:26:39 EST 2012

Hi, everyone. I was wondering if it was possible to have the REPL automatically
reload when the file is changed. Currently I came up with this in my .racketrc
...

    (define-syntax-rule (reload f)
      (lambda ()
        (for ([i (in-naturals)])
             (enter! f)
             (sleep 0.5))))

...which I use with `(thread (reload "file.rkt"))` in the REPL. It shows
[reloading /path/to/file.rkt] when the file is edited, but the namespace in the
REPL doesn't change. (If I do `(enter! "file.rkt")` in the REPL, it works just
fine) I fear that I'm going about this the wrong way, though. Is there a better
way of getting an auto-reloading REPL? If not, is there a way to fix what I
have currently?

Thank you!

~Dennis


Posted on the users mailing list.