Re: [racket] Lifting submodules

2013-09-18 Thread Greg Hendershott
Thank you for showing how to make it work. Now as to why it works... sadly I'm still confused. > For this example, if I understand the docs correctly, the scope of the > require-spec has to match the scope of the use. > > http://docs.racket-lang.org/reference/syntax-model.html?#(part._macro-intro

Re: [racket] Lifting submodules

2013-09-17 Thread Stephen Chang
> I've been trying to answer it, but having one of those humbling > experiences where I wonder how much I've really learned about macros, > after all. I distilled it to just: > > #lang racket > (define-syntax (define-modularize stx) > (syntax-case stx () > ([_ thing-name mod-name] > #'(

Re: [racket] Lifting submodules

2013-09-17 Thread Greg Hendershott
> I want to write a macro which generates submodules and then possibly > requires them. This is so that can easily use another language (TR) > for the expression. > > If all uses of the macro are at the top-level/module-level this is > easy and I can expand out to something like: > (begin > (modu

Re: [racket] Lifting submodules

2013-09-16 Thread Sam Tobin-Hochstadt
When I tried this, I was able to lift 'module+ main' successfully using 'syntax-local-lift-module-end-declaration'. I could also lift a 'module', but then requiring the lifted module didn't work. Sam On Sep 13, 2013 11:25 PM, "Matthew Flatt" wrote: > Right -- there's currently no way to lift a m

Re: [racket] Lifting submodules

2013-09-13 Thread Matthew Flatt
Right -- there's currently no way to lift a module declaration after expansion starts working on expressions within a module. I think that operation could be added, and I'll look into it as soon as possible. At Fri, 13 Sep 2013 19:41:55 -0700, Eric Dobson wrote: > Which lifting function? All of t

Re: [racket] Lifting submodules

2013-09-13 Thread Eric Dobson
Which lifting function? All of the ones I found didn't do what I needed when called from an expression context, as the lifted syntax was also in expression context. (syntax-local-lift-expression, and syntax-local-lift-module-end-declaration) On Fri, Sep 13, 2013 at 1:53 PM, Matthias Felleisen wro

Re: [racket] Lifting submodules

2013-09-13 Thread Matthias Felleisen
Lift the module definition to top and require in the expression position? On Sep 13, 2013, at 12:08 PM, Eric Dobson wrote: > I want to write a macro which generates submodules and then possibly > requires them. This is so that can easily use another language (TR) > for the expression. > > If