<p>Thanks for the clarification.<br>
</p>
<div class="gmail_quote">On Jan 26, 2013 6:55 AM, "Matthew Flatt" <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
At Sat, 26 Jan 2013 01:12:04 -0500, Stephen Chang wrote:<br>
> Is this a supported use of submodules?<br>
><br>
><br>
> #lang racket<br>
><br>
> (define-syntax (def-wrapped stx)<br>
> (syntax-case stx ()<br>
> [(_ (f arg ...) body ...)<br>
> #'(begin<br>
> (module tmp-module-name racket<br>
> (define (f-tmp arg ...) (displayln "wrapper") body ...)<br>
> (provide (rename-out [f-tmp f])))<br>
> (require (quote tmp-module-name)))]))<br>
><br>
> (def-wrapped (f x) (+ x 1))<br>
> (f 100)<br>
><br>
><br>
> Welcome to DrRacket, version 5.3.1.3 [3m].<br>
> Language: racket [custom].<br>
> . f: unbound identifier in module in: f<br>
<br>
Your `require' is macro-introduced, so it only binds uses that are also<br>
macro-introduced. Try renaming on import, since the rename target is an<br>
identifier supplied to the macro:<br>
<br>
#lang racket<br>
<br>
(define-syntax (def-wrapped stx)<br>
(syntax-case stx ()<br>
[(_ (f arg ...) body ...)<br>
#'(begin<br>
(module tmp-module-name racket<br>
(define (f-tmp arg ...) (displayln "wrapper") body ...)<br>
(provide f-tmp))<br>
(require (rename-in (quote tmp-module-name)<br>
[f-tmp f])))]))<br>
<br>
(def-wrapped (f x) (+ x 1))<br>
(f 100)<br>
<br>
</blockquote></div>