Did you see this earlier email? I got a similar "identifier tainted by macro expansion" error, but changing `define-syntax-rule` to `define-simple-macro` fixed it:
> On Apr 25, 2016, at 5:03 PM, Alex Knauth <[email protected]> wrote: > > >>> On Apr 25, 2016, at 3:43 PM, Matthew Butterick <[email protected]> wrote: > >>> ;;;;;;;;;;;;;; >>> #lang racket >>> >>> (define-syntax-rule (binding-form _topid (_id ...)) >>> (define (_topid) >>> (let ([_id '_id] ...) >>> (displayln (format "~a bound ~a" '_topid _id)) ...))) >>> >>> (binding-form foo (a b c)) >>> (foo) ; works >>> >>> (define-syntax-rule (id-maker _a "," _b "," _c) >>> (_a _b _c)) >>> >>> (binding-form bar (id-maker a ZIM b ZAM c)) >>> (bar) ; fails, will treat `(id-maker ..)` expr as list of literal ids > > Actually, no need for match expanders or generic bind (it wasn't a binding > position anyway), this works: > > #lang racket > > (require syntax/parse/define) > > (define-syntax-parser binding-form > [(binding-form _topid id-stuff) > #:with [_id ...] (local-expand #'id-stuff 'expression #f) > #'(define (_topid) > (let ([_id '_id] ...) > (displayln (format "~a bound ~a" '_topid _id)) ... > (void)))]) > > (binding-form foo (a b c)) > (foo) ; works, prints foo found a, etc. > > ;; this has to be define-simple-macro, not define-syntax-rule > (define-simple-macro (id-maker _a "," _b "," _c) > (_a _b _c)) > > (binding-form bar (id-maker x "," y "," z)) > (bar) ; works, prints bar found x, etc. > > Actually I'm surprised that this worked; I expected it to be much more > difficult. Does this allow you to do what you want? > > Alex Knauth -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

