I'm not 100% sure but I think that's right: the marks clobber each other so
that you see the inner frame and a `let`'s body is in tail position wrt to
the let itself. So in this program:
#lang racket/base
(define (f x) (car x))
(let ()
(let ()
(+ (let ()
(let ()
(f #f))))))
You see the stack frames for the + and for the call to `car`, but not for
the `let`s or the call to `f`.
Robby
On Sat, Aug 14, 2021 at 10:00 AM Shu-Hung You <[email protected]>
wrote:
> 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
> <[email protected]> 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 <[email protected]>
> 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 [email protected].
> >> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAMTzy%2BY%3DgzoDviM5q8OhSsUcJnDUSxfnAVc7uZv2ZR97ckOnXA%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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CAL3TdOMEsqCXSL%3DiXpE5b%3DqTmyZ3x7pqncm3XNzE2svvqiNVbQ%40mail.gmail.com.