Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread Matthew Butterick
Thank you for the explanation. As a new Racket user, in general I find the docs thorough and well done. (I have HTDP and SICP nearby as well.) Coming to Racket from Python, the differences in the module system have been slowest to take hold (exacerbated by the fact that one cannot temporarily kludg

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread Matthew Flatt
At Sun, 28 Apr 2013 08:28:46 -0700, Matthew Butterick wrote: > > > > The syntax of `enter!' is supposed to be like `require', where the > > module name is not quoted > > > OK, I see what you're saying. And yes, the enter! / require connection is > noted in the docs. > > As a reader of docs, what

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread J. Ian Johnson
(EDT) Subject: Re: [racket] Evaluating Racket source files from within another Racket source file > > The syntax of `enter!' is supposed to be like `require', where the > module name is not quoted OK, I see what you're saying. And yes, the enter! / require connection is

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread Matthew Butterick
> > The syntax of `enter!' is supposed to be like `require', where the > module name is not quoted OK, I see what you're saying. And yes, the enter! / require connection is noted in the docs. As a reader of docs, what trips me up here is that the docs for enter! and require both refer to a modul

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread Matthew Flatt
The syntax of `enter!' is supposed to be like `require', where the module name is not quoted. If you remove the quote, then something like (enter! file/gif) doesn't work. It would make sense to move the transitive module-reloading part of `enter!' to a a new module and provide a `dynamic-re-re

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-28 Thread Matthew Butterick
Thanks, I'll try that. However, I still think there might be a bug in racket/enter.rkt. Currently lines 10-11 look like this: [(enter! mod flag ...) (andmap keyword? (syntax->datum #'(flag ...))) #'(do-enter! 'mod '(flag ...))] But when I remove the quoting from mod in line 11, like so

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-27 Thread Matthew Flatt
I think you probably want to create a new namespace for each instantiation of the Scribble module, and attach Scribble (or whatever modules you want to stay the same across runs) to the namespace before `dynamic-require'ing the module in the new namespace: #lang racket/base (require scribble/bas

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-27 Thread Matthew Butterick
OK, so the proposed solution failed once I tried to pass in the module name as a variable. Even though enter! claims to take a module-path as an argument, this will not work: (define name "module.rkt") (module-path? name) ; reports #t (enter! name) ; error: collection "name" not found enter! is

Re: [racket] Evaluating Racket source files from within another Racket source file

2013-04-27 Thread Matthew Butterick
Aha, combining enter! with dynamic-require seems to do the trick: (define (route req) (enter! "module.rkt") (define foo (dynamic-require "module.rkt" 'foo)) (response/xexpr `(p ,(format "~a" foo Once this route is running in the web server, I can make changes to module.rkt, then c

[racket] Evaluating Racket source files from within another Racket source file

2013-04-27 Thread Matthew Butterick
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 t