#lang racket also provides racket/base in the transformer environment.

-Philip

On Tue, Mar 14, 2017 at 5:45 AM, NeverTooOldToCode <jrhondebr...@gmail.com>
wrote:

> From Fear of Macros again, all input in the DrRacket definition window.
>
> This works:
>
> #lang racket/base
>
> (require (for-syntax racket/base))
>
> (define-syntax (show-me stx)
>   (display stx)
>   #'(void))
>
> If you mouse-hover over the keywords, define-syntax is imported from #lang
> racket/base, and display and #' are imported (require (for-syntax
> racket/base)).
> Because display and #' are needed at compile time, not run time.
>
> Therefore, logically, this doesn't work:
>
> #lang racket/base
>
> (define-syntax (show-me stx)
>   (display stx)
>   #'(void))
>
> Gives the error:
> display: unbound identifier in the transformer environment; also, no #%app
> syntax transformer is bound in: display
> And if we remove the display statement, the same error for #'
>
> So far so good.
>
> BUT
>
> Why does this work?
>
> #lang racket
>
> (define-syntax (show-me stx)
>   (display stx)
>   #'(void))
>
> Now define-syntax *and* display *and* #' are directly imported from #lang
> racket. What about compile time vs run time? What does #lang racket do
> apart from including many libraries on top of racket/base?
>
> --
> 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.
>

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