<div dir="ltr">I'm building a website using Scribble as the source format. As a development tool, I've built a web server in Python that lets me view all my Scribble source files and look at them in different states of processing. To view the results of the Scribble files, the Python server just sends the files to Racket via a system command (os.Popen) and reads the result. This works but it's slow, because it has to launch a new Racket thread for every request.<div>
<br></div><div>I thought I could speed things up by rewriting the development web server in Racket. But having tried a few approaches, I'm not sure how to duplicate this functionality within a Racket web servlet: </div>
<div><br></div><div><b>(require <modulename>) </b></div><div>This only gets evaluated once, when the server is started. That doesn't help, since the <filename> is going to be passed in as a parameter while the server is running.</div>
<div><br></div><div><div style><b>(dynamic-require <</b><b> modulename </b><b>>) </b></div></div><div style>This gets evaluated only when invoked, and thus can take <modulename> as a parameter, but then <filename> can't be reloaded (this is essential, as the point of the system is to be able to edit the files and see the changes in the web browser immediately)</div>
<div style><br></div><div style><b>(enter! <modulename>)</b></div><div style>This reloads the file, but it's not clear how to get access to names provided by <modulename>. (The documentation for enter! suggests that this is not how it's meant to be used anyhow.)</div>
<div style><br></div><div style>Obviously, I could call a new instance of Racket as a system command, but that wouldn't offer any advantage over the current approach.</div><div style><br></div><div style><br></div><div style>
I suppose what I'm looking for is an equivalent of the Python reload(<modulename>) command.<br></div><div style><br></div><div style><br></div><div style>Matthew Butterick<br></div></div>