[plt-dev] possible bug in syntax position of dotted syntax

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Fri Jan 29 17:14:55 EST 2010

I noticed that when I use a dotted template for syntax-case (and 
syntax-parse) that the dotted element has a syntax-position equivalent 
to the entire expression. Is this expected behavior?

(define (with-syntax-case stx)
   (syntax-case stx ()
                [(a b c . d)
                 (printf "a is at ~a\n" (syntax-position #'a))
                 (printf "b is at ~a\n" (syntax-position #'b))
                 (printf "c is at ~a\n" (syntax-position #'c))
                 (printf "d is at ~a\n" (syntax-position #'d)))]))

(with-syntax-case #'(1 2 3 4))

a is at 695
b is at 697
c is at 699
d is at 694

I would expect `d' to be at position 701 instead of 694.

Posted on the dev mailing list.