As I play with that example I see that changing #'(let () ...) to #'(begin ...) fixes the issue. Unfortunately in my actual program I can't do that. Here is an example more akin to the context I'm working in, where that fix doesn't work:
#lang racket (provide a) (define a 1) ;; make the submodule (define-syntax (mod stx) #'(module* R racket (require (submod ".." T)) (test-binding (submod "..")))) ;; defines the requiring macro (module T racket (provide test-binding) (require (for-syntax syntax/parse)) (define-syntax (test-binding stx) (syntax-parse stx [(_ path) #'(begin (require path) a)]))) ;; go (mod) On Thu Nov 06 2014 at 3:09:28 PM Spencer Florence <spen...@florence.io> wrote: > Hi All, > > I've been struggling to have a macro be given a path then require > something from that path. The following code produces and "Unbound > Identifier" error, although I would expect it to evaluate to 1. Could > someone provide insight into what is going on? > > #lang racket/load > ;;provider > (module T racket > (provide a) > (define a 1)) > ;; requirer > (module R racket > (require (for-syntax syntax/parse)) > (define-syntax (test-binding stx) > (syntax-parse stx > [(_ path) > #'(let () (local-require (only-in path a)) a)])) > (test-binding 'T)) > ;; go > (require 'R) > > > P.S. I attempted to do this with `dynamic-require,` but that failed > because in my actual program `path` is sometimes `(submod "..")`, which > caused an error about not having a base path. > >
____________________ Racket Users list: http://lists.racket-lang.org/users