The docs 
(http://docs.racket-lang.org/syntax/stxparse-patterns.html#%28def._%28%28lib._syntax%2Fparse..rkt%29._pattern-expander%29%29)
 give an example, ~maybe, that doesn't actually work:

> (define-syntax ~maybe
    (pattern-expander
     (syntax-rules ()
      [(~maybe pat ...)
       (~optional (~seq pat ...))])))
> (define-syntax-class blah
  (pattern (hi (~maybe two three) ...)))
. ~optional: cannot use identifier tainted by macro transformation in: ~optional

I noticed this because I wanted to do something analogous, which fails with the 
same error (identifier tainted by macro transformation):

(define-syntax ~bdatum
  (pattern-expander
   (syntax-rules ()
     [(~bdatum id)
        (~and id (~datum id))]
       [(~bdatum bid id)
        (~and bid (~datum id))])))


Any insight into either correct usage of pattern-expander, or a more efficient 
shorthand to achieve the same result I was aiming for with ~bdatum (being able 
to match with ~datum while still having a pattern variable that preserves 
source information).

Thanks!

-- 
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.

Reply via email to