[racket] require/provide inside a macro

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Fri Nov 18 17:22:40 EST 2011

require and provide seem to exhibit strange behavior when used inside a macro. Here, the `all-prefix' macro works (because of the 'prefix-in' somehow) while the `all' macro doesn't.

#lang racket/base

(define-syntax-rule (all-prefix)
     (require (for-meta 1 (prefix-in x: racket/base)))
     (provide (for-meta 1 x:printf))))

(define-syntax-rule (all)
     (require (for-meta 1 racket/base))
     (provide (for-meta 1 printf))))


Posted on the users mailing list.