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.