Re: [racket-users] Macros crossing documentation-time and run-time phases

2019-03-21 Thread Matthew Flatt
At Mon, 18 Mar 2019 19:32:40 -0400, Philip McGrath wrote: > On Mon, Mar 18, 2019 at 9:14 AM Matthew Flatt wrote: > > > I wonder whether the solution is an extension of `scribble/lp2` to > > support a `require-for-chunk` form where `chunk` records any such > > imports in its context and adds then

Re: [racket-users] Macros crossing documentation-time and run-time phases

2019-03-18 Thread Philip McGrath
On Mon, Mar 18, 2019 at 9:14 AM Matthew Flatt wrote: > I wonder whether the solution is an extension of `scribble/lp2` to > support a `require-for-chunk` form where `chunk` records any such > imports in its context and adds then to the stitched-together program. > > (require-for-chunk (only-in

Re: [racket-users] Macros crossing documentation-time and run-time phases

2019-03-18 Thread Matthew Flatt
Just to make sure we're on the same page, it seems like your example fails for the same reason that #lang scribble/lp2 @(require racket/string) @(chunk <*> string-join) fails. That `require` turns out to do nothing, and there's no binding of `string-join` in the "phase" of the program is that

[racket-users] Macros crossing documentation-time and run-time phases

2019-03-18 Thread Philip McGrath
Racket makes it easy to write macros that mix run-time code with various compile-time phases, using lexical scope to refer unambiguously to the correct binding for each identifier, including bindings that are not directly exported. Macro-generating macros are a great example, in that they expand