The example in the manual for quote-srcloc shows it wrapped as a syntax object, 
and it gives the correct call point location answer.  however, when the result 
from quoteloc is instead put in a variable, then variable has the wrong 
location (not the call location of stx).

An explanation of this behavior would shed a lot of light on this subject.

The objective here is to get a source/loc structure with call point from the 
stx passed into the syntax transformer.  Is this what quote-srcloc is for?

  #lang racket

    (require racket/match)
    (require (for-syntax racket/match))

    (require syntax/location)
    (require (for-syntax syntax/location))



  (define-syntax (here stx) #`(quote-srcloc #,stx))

  (define-syntax (here2 stx) 
      (let(
            [a-location (quote-srcloc stx)]
            )
        (datum->syntax stx a-location)
        ))


  (here)
  (here2)


  #|
  rac...@test-here.rkt> (enter! "test-here.rkt")
    [re-loading /home/deep/liquid-extensions/liquid/test-here.rkt]
  (srcloc "<pkgs>/liquid-extensions/liquid/test-here.rkt" 21 0 342 6)  <-- yes 
line 21
  (srcloc "<pkgs>/liquid-extensions/liquid/test-here.rkt" 15 36 276 3) <-- heck 
no should be line 22
  rac...@test-here.rkt>

  |#

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