[racket-dev] submodule in macro

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Sat Jan 26 01:12:04 EST 2013

Is this a supported use of submodules?

#lang racket

(define-syntax (def-wrapped stx)
  (syntax-case stx ()
    [(_ (f arg ...) body ...)
         (module tmp-module-name racket
           (define (f-tmp arg ...) (displayln "wrapper") body ...)
           (provide (rename-out [f-tmp f])))
         (require (quote tmp-module-name)))]))

(def-wrapped (f x) (+ x 1))
(f 100)

Welcome to DrRacket, version [3m].
Language: racket [custom].
. f: unbound identifier in module in: f

Posted on the dev mailing list.