> On Nov 23, 2015, at 10:30 AM, thomas.lynch 
> <thomas.ly...@reasoningtechnology.com> wrote:
> 
> Without syntax/loc,  no location of error in macro:
> 
> (define-syntax (messup5 stx) 
>    (datum->syntax stx
>      (let (
>             [a 7]
>             [b 9]
>             )
>        (^ a b)
>       )))
>  (messup5)


The difference here is not syntax/loc, this same difference would be there if 
you replaced (syntax/loc stx ...) with (syntax ...).

But whenever you use datum->syntax (even if you have a source-location 
argument), it doesn't put source locations on inner expressions (unless they 
are syntax objects and they already have it). 

> With syntax/loc, the error is pointed out in the macro.
> 
> (define-syntax (messup4 stx) 
>    (syntax/loc stx
>      (let (
>             [a 7]
>             [b 9]
>             )
>        (^ a b)
>       )))
>  (messup4)

Does

(define-syntax (messup/syntax stx)
  (syntax
    (let ([a 9]
          [b 9])
      (^ a b))))

also do that though?

> In both cases the caller is not in the back trace. 


What syntax/loc would do is put the source location of the caller in the back 
trace. It only goes one level deep though, so you're not getting the actual 
benefit of using syntax/loc over syntax, unless the error happens in the outer 
let expression instead of one the inner expressions.

Alex Knauth

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