As a `require` form, a `submod`'s binding context is taken from the parenthesis around the `submod`. With options (A) and (B), the context of those parentheses is macro-introduced.
At Sat, 17 Jun 2017 16:49:50 -0400, Tony Garnock-Jones wrote: > #lang racket > ;; > ;; Hi all (Matthew in particular I imagine :-) ), > ;; > ;; Why does option (C) work, but options (A) and (B) do not? > ;; > ;; They fail with: > ;; > ;; t.rkt:31:2: v1: unbound identifier in module > ;; in: v1 > ;; context...: > ;; standard-module-name-resolver > ;; > ;; -- Tony > > (require racket/require-syntax) > > ;;------------------------------(A)------------------------------ > ;; (define-require-syntax m+ > ;; (syntax-rules () > ;; [(_ xs ...) > ;; (submod ".." xs ...)])) > > ;;------------------------------(B)------------------------------ > ;; (define-require-syntax (m+ stx) > ;; (syntax-case stx () > ;; [(_ xs ...) > ;; #'(submod ".." xs ...)])) > > ;;------------------------------(C)------------------------------ > (define-require-syntax (m+ stx) > (syntax-case stx () > [(_ xs ...) > (datum->syntax stx (list* 'submod ".." #'(xs ...)))])) > > > (module+ m1 > (provide v1) > (define v1 123)) > > (module+ main > (require (m+ m1)) > v1) > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

