That looks like a bug in syntax snips. Programmatically, I get the results one would expect.
Here's my program (yours plus a few lines): ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #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) (require syntax/srcloc) (define (walk-syntax stx . ns) (for/fold {[stx stx]} {[n (in-list ns)]} (list-ref (syntax->list stx) n))) (define (get-x stx) (walk-syntax stx 3 1)) (define (get-y stx) (walk-syntax stx 3 2)) (define x1 (get-x a-bigger-syntax)) (define x2 (get-x a-reconstructed-syntax)) (define y1 (get-y a-bigger-syntax)) (define y2 (get-y a-reconstructed-syntax)) (for/list {[id (in-list (list x1 x2 y1 y2))]} (list (syntax-e id) (build-source-location id))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; And here's the output I get (after the two syntax snips): (list (list 'hello (srcloc 'my-source 3 3 18 5)) (list 'hello (srcloc 'my-source 3 3 18 5)) (list 'world (srcloc 'my-source 3 9 24 5)) (list 'world (srcloc 'my-source 3 9 24 5))) So I have no idea why the snips are saying something else. Carl Eastlund On Wed, Jun 29, 2011 at 2:39 PM, Danny Yoo <d...@cs.wpi.edu> wrote: >> 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. > > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users