Based on this experiment, the double-quoted sub should be the right thing, and the single-quoted inside the datum->syntax with another quote in the require and provide forms shouldn't work.
Just like this works: #lang racket (require syntax/parse/define) (define-simple-macro (m x) #:with req-spec (datum->syntax #'x ''sub) (begin (module sub racket/base (provide y) (define y 3)) (require req-spec))) (m x) y But this doesn't: #lang racket (require syntax/parse/define) (define-simple-macro (m x) #:with req-spec (datum->syntax #'x 'sub) (begin (module sub racket/base (provide y) (define y 3)) (require 'req-spec))) (m x) y On Aug 16, 2015, at 12:09 AM, Matthew Butterick <m...@mbtype.com> wrote: > No, the double-quoted ''sub doesn't work (triggers bad-syntax error). > > Nor does this (with quotes added to `sub-id` within the `require` and > `provide` forms): > > (define-syntax my-module-begin > (lambda (stx) > (syntax-case stx () > [(_ body ...) > (with-syntax ([sub-id (datum->syntax stx 'sub)]) > #'(#%module-begin > (module sub-id racket/base > (define x 2) > (provide x)) > (require 'sub-id) > (provide (all-from-out 'sub-id)) > body ...))]))) > > On Sat, Aug 15, 2015 at 9:56 PM, Alexander D. Knauth <alexan...@knauth.org> > wrote: > > On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth <alexan...@knauth.org> > wrote: > > > Does this work? > > (define-syntax my-module-begin > > (lambda (stx) > > (syntax-case stx () > > [(_ body ...) > > (with-syntax ([sub-id (datum->syntax stx ''sub)]) > > #'(#%module-begin > > (module sub-id racket/base > > (define x 2) > > (provide x)) > > (require sub-id) > > (provide (all-from-out sub-id)) > > body ...))]))) > > I just realized that's not your example, so anyway, does modifying your > example to use (datum->syntax stx ''sub) instead of (datum->syntax stx 'sub) > work? > > -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.