Although I haven't tried to put the pieces together to do this, I
_think_ the pieces are:

1. It's easy to make a "REPL server". Following the early sections of
the tutorial from https://docs.racket-lang.org/more/index.html you
could something like the following. (For production you might want to
go further into the tutorial and e.g. use custodians.)

#lang racket/base

(require racket/tcp)

(define (serve port)
  (define listener (tcp-listen port 5 #t))
  (let loop ()
    (accept-and-handle listener)
    (loop)))

(define (accept-and-handle listener)
  (define-values (in out) (tcp-accept listener))
  (parameterize ([current-input-port  in]
                 [current-output-port out])
    (read-eval-print-loop))
  (close-input-port in)
  (close-output-port out))


2. When you connect to that REPL server, at its prompt you could use
`dynamic-rerequire` to (re)load your code.

https://docs.racket-lang.org/reference/interactive.html#%28def._%28%28lib._racket%2Frerequire..rkt%29._dynamic-rerequire%29%29


As I mentioned on IRC last night before I had to run, one example of
wrapping up dynamic-rerequire is the racket-reloadable package:

https://github.com/tonyg/racket-reloadable


I hope this helps a little? If not hopefully someone with more
hands-on experience could chime in.

(I love the idea of live-coding music and games! But how I actually
use Racket, my comfort zone is "version-controlled source files are
the single source of recreatable truth". So, I don't have a lot of
mileage with this.)

-- 
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