While Jay and Sam have tried to answer the question you actually asked, my advice would be to approach this differently. When I am developing web server things interactively, I put them in the DrRacket definitions window and run the program with the "Run" button. You can then poke at the running server, see logging output, etc. at the DrRacket REPL. If I change something, I change it in the DrRacket definitions window and press "Run" again to re-start the server. (None of this is DrRacket-specific, but that's how I do it, and I think it works especially well.)
I think this approach takes advantage of all of the generally nice things about the Racket-style REPL. In particular, I could imagine getting confused if I had `set!` part of the program to do something other than what the definitions window said, and I could especially easily imagine clicking run again without saving something I'd worked up interactively and loosing that work. The one place where this can be a downside is when the program has a very long startup time. When I've had such cases, I've found it useful, even beyond these circumstances, to give myself a hook to replace the expensive parts with a noop when I don't actually care about them. -Philip On Wed, Oct 3, 2018 at 5:12 PM Cam <cam@tindall.space> wrote: > > It looks like Sam's suggestion of racket-reloadable is exactly what I > need, but I will play with this as well. Thanks! > > Jay McCarthy <jay.mccar...@gmail.com> writes: > > > You'd have to build it yourself, by doing a `set!` in the REPL to > > inject the new function in. > > On Wed, Oct 3, 2018 at 8:10 AM Cam <cam@tindall.space> wrote: > >> > >> > >> I am playing around with the built-in webserver functionality with > >> `servlet/serve' and am wondering if there is a way to automatically > >> "reload" the servlet, for lack of better terminology, when I am playing > >> in the REPL. In other words, if I do something like this in the REPL: > >> > >> (define (about-page req) > >> (response/xexpr > >> '(html (body (h1 "about"))))) > >> > >> (define-values (dispatch handler->url) > >> (dispatch-rules > >> [("about") about-page])) > >> > >> (serve/servlet > >> #:port 8088 > >> #:listen-ip #f > >> #:servlet-path "/" > >> #:servlet-regexp #px".*" > >> dispatch) > >> > >> ...and then redefine `about-page' like this: > >> > >> (define (about-page req) > >> (response/xexpr > >> '(html (body (h1 "something else"))))) > >> > >> ...I would like to refresh my browser on the `/about' page and see > >> "something else" instead of "about". > >> > >> Is there some way to achieve 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. > > > > > > > > -- > > -=[ Jay McCarthy http://jeapostrophe.github.io ]=- > > -=[ Associate Professor PLT @ CS @ UMass Lowell ]=- > > -=[ Moses 1:33: And worlds without number have I created; ]=- > > -- > 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. > -- 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.