[racket] Using ... in a syntax pattern destroys location information?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Jun 29 14:39:28 EDT 2011

> Can you be more specific about what "funkiness" means?  That is, give
> us a full program and its output that shows an expected and actual
> source location that differ.  Right now there are a few things you
> could be referring to.

I think I was being mislead by what might be behavior from DrRacket's
5.1.1's printing of syntax objects.  When I introduce displaylns to
let me explore the structure of the syntaxes, as in:

#lang racket
(define x (datum->syntax #f 'hello (list 'my-source 3 3 18 5)))
(define y (datum->syntax #f 'world (list 'my-source 3 9 24 5)))
(define a-bigger-syntax #`(module foo racket/base (#%module-begin #,x #,y)))
(define a-reconstructed-syntax
 (syntax-case a-bigger-syntax ()
   [(module name language (a-modbeg body ...))
    #'(module name language (a-modbeg body ...))]))

(displayln a-bigger-syntax)
(displayln a-reconstructed-syntax)

then under DrRacket's syntax printer, if I click on the 'hello
identifier of the snip representation for a-bigger-syntax, I can
observe that it's at position 18, line 3, column 3, and span 5.
That's what I expect, because I built the syntax object that way.

But if I click on the 'hello identifier of the a-reconstructed-syntax
graphical snip, the snip reports itself as being at position 358, line
8, column 28, with a span of 19, which is not correct.  So something
strange is happening here.

Posted on the users mailing list.