Cool! I thought the existing syntax/loc have already put the correct
source location on the output of the macro, but the inner let is
taking over the stack frame.

On Sat, Aug 14, 2021 at 12:49 AM Sorawee Porncharoenwase
<sorawee.pw...@gmail.com> wrote:
>
> Isn’t that a matter of putting more syntax/loc? I tried:
>
> (-define-syntax let-syntaxes
>     (lambda (stx)
>       (syntax-case stx ()
>     [(_ ([(id ...) expr] ...) body1 body ...)
>      (with-syntax ([((tmp ...) ...)
>             (map
>              generate-temporaries
>              (syntax->list (syntax ((id ...) ...))))])
>        (with-syntax ([inner-body
>                       (syntax/loc stx
>                         (letrec-syntaxes+values
>                             ([(id ...)
>                               (values
>                                (make-rename-transformer (quote-syntax tmp))
>                                ...)] ...)
>                             ()
>                           body1 body ...))])
>          (syntax/loc stx
>            (letrec-syntaxes+values ([(tmp ...) expr] ...) ()
>              inner-body))))])))
>
> and the button now functions as you expect.
>
>
> On Fri, Aug 13, 2021 at 7:45 PM Shu-Hung You <shh...@u.northwestern.edu> 
> wrote:
>>
>> Here are two syntax errors that behave differently in DrRacket:
>>
>> #lang racket
>>
>> (define-syntax (m-late stx)
>>   #'(let () (define x 0)))
>> (define-syntax (m-early stx)
>>   #'(let-syntax () (define x 0)))
>>
>> ; (m-late)
>> ; (m-early)
>>
>> DrRacket *correctly* highlights the source location of the errors in
>> both cases. Additionally, for (m-early) I can click on the X button to
>> jump to the error location.
>>
>> However, for (m-late) the X button brings me to internal Racket code.
>> What's going on here?
>>
>> In case it helps, here are the error messages when I run the code in 
>> terminal:
>>
>> ;; m-late
>> errstx.rkt:4:4: begin (possibly implicit): no expression after a
>> sequence of internal definitions
>>   in: (begin (define x 0))
>>   location...:
>>    /Volumes/ramdisk/errstx.rkt:4:4
>>    /Volumes/ramdisk/errstx.rkt:4:12
>>
>> ;; m-early
>> <collects>/racket/private/letstx-scheme.rkt:38:17: begin (possibly
>> implicit): no expression after a sequence of internal definitions
>>   in: (begin (define x 0))
>>   location...:
>>    <collects>/racket/private/letstx-scheme.rkt:38:17
>>    /Volumes/ramdisk/errstx.rkt:6:19
>>
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/CAMTzy%2BZtpWGdtkZkvzF4%3D25kpqUqGKsBcCDf4T%3DY3S2hV0v_GA%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAMTzy%2BY%3DgzoDviM5q8OhSsUcJnDUSxfnAVc7uZv2ZR97ckOnXA%40mail.gmail.com.

Reply via email to