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-introduced-bindings) > > "In require for other require-specs, the generator of the require-spec > determines the scope of the bindings" Although I wasn't familiar with that part of the docs (thanks for pointing it out!), it did occur to me that the module name would need to have the same lexical scope. In my attempt... (define-syntax (define-modularize stx) (syntax-case stx () ([_ thing-name mod-name] #'(begin (module mod-name racket (define thing-name #t) (provide thing-name)) (require 'mod-name))))) ;; or, (require (submod "." mod-name)) (define-modularize foo foo-mod) foo ;; => foo: unbound identifier in module ...I reasoned that "mod-name is a pattern variable, and pattern variables automatically carry the lexical scope of the syntax given to syntax-case". Right? So in my attempt, how does the usage scope of `foo-mod` get "sliced off" in the pattern variable `mod-name`? Is it a result of needing to quote the module name, `(require 'mod-name)`? But `(require (submod "." mod-name)` doesn't quote it and that doesn't work either. ____________________ Racket Users list: http://lists.racket-lang.org/users