Alex, yes thank you, the quote-srcloc works at run time, so for example:
(define-syntax (here3 stx)
(let(
[program `(quote-srcloc ,stx)]
)
(datum->syntax stx program)
))
Will print the call point. What the heck is this macro, as it is being
The Clan of Colon Keywords was willing to honor a truce.
I think for people coming from other languages with :keywords, Racket's
#:keywords help to signal that they are not anything like how :keywords are
usually used.
I'm sure there are relatively better justifications for pound-colon
what is the difference between syntax-case matched identifiers, and those
provided by let. This example crashes and burns on load:
(define-syntax (fine1 stx)
(let (
[a 7]
[b 9]
)
(syntax/loc stx
(+ a b)
)))
Which begs the question,
Racket version 6.3 is now available from
http://racket-lang.org/
- Racket's macro expander uses a new representation of binding called
"set of scopes". The new binding model provides a simpler
explanation of how macros preserve binding, especially across module
boundaries and in
p.s. for reference here,
Without syntax loc, no location of error in macro:
#|
(define-syntax (messup5 stx)
(datum->syntax stx
(let (
[a 7]
[b 9]
)
(^ a b)
)))
(messup5)
rac...@test-macro-dev-error.rkt> (enter!
`syntax-case` (and `with-syntax` and others) bind template identifiers,
that you can use inside #', #`, `syntax/loc`, etc.
`let`, and other regular Racket binding forms bind ordinary identifiers.
To use those within a template, you need to unquote, as you suggest.
`syntax/loc` is like `syntax`
>
> 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
> On Nov 23, 2015, at 10:30 AM, thomas.lynch
> wrote:
>
> Without syntax/loc, no location of error in macro:
>
> (define-syntax (messup5 stx)
>(datum->syntax stx
> (let (
> [a 7]
> [b 9]
> )
>(^ a b)
thank you !!
--
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
9 matches
Mail list logo