[racket] syntax/parse ellipses question

From: Eric Dobson (endobson at cs.brown.edu)
Date: Fri Jun 11 15:21:00 EDT 2010

I'm trying to use the syntax/parse library, and am running into a
weird problem when using ~or. It works without ellipses, but with
ellipses it complains about a duplicated attribute. I would assume
that the attributes with the same name in an ~or pattern were the same
attribute that could just match in different ways. A simplified
version is below, the first 4 examples work, and the fifth does not.
Is there a restriction that I am missing for why this does not work?

Thanks,
Eric

#lang racket
(require syntax/parse)

(syntax-parse #'(1 2 3)
 [((~or x:number) ...) (syntax->datum #'(x ...))])

(syntax-parse #'(a b c)
 [((~or x:id) ...) (syntax->datum #'(x ...))])

(syntax-parse #'(1)
 [((~or x:id x:number)) (syntax->datum #'(x))])

(syntax-parse #'(a)
 [((~or x:id x:number)) (syntax->datum #'(x))])

#;
(syntax-parse #'(a 1 b)
 [((~or x:id x:number) ...) (syntax->datum #'(x ...))])


Posted on the users mailing list.