On Aug 1, 2017, at 11:34, Jens Axel Søgaard <jensa...@soegaard.net> wrote:
> The binding information is attached a syntax object during expansion.
> In your example the #'(define x y) haven't gone through expansion,
> so you do not get what your expected result.
> However we can change your macro a little...

Ah, that clarifies everything. Thanks!

So, the example I quoted is actually from the docs on ~datum 
 and it seems pretty clear that it’s trying unsuccessfully to elicit different 
behaviors that show the difference between ~literal and ~datum. Based on the 
code you’ve provided, I think this would be a better illustration:

> (define-syntax (is-define? stx)
>   (syntax-parse stx
>     [(_is-define? id)
>      (syntax-parse #'id
>        [(~literal define) #''yes]
>        [(~datum   define) #''not-really]
>        [_                 #''not-even-close])]))
> (is-define? define)         ;; 'yes
> (let ([define 42])
>   (is-define? define))      ;; 'not-really
> (is-define? something-else) ;; 'not-even-close

I’ve submitted that as a PR on the doc file linked above. I hope you don’t mind 
my using your example in that way. It was very helpful.


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