Re: [racket-users] macro definitions with #lang racket/base vs #lang racket

2017-03-14 Thread NeverTooOldToCode
Thank you! 
I see now that the very same question was already asked on this list in 2015, 
by a compatriot of mine no less. It didn't show up in my online searches 
beforehand, the keyword missing was "transformer environment".

On Tuesday, March 14, 2017 at 1:05:31 PM UTC+1, Philip McGrath wrote:
> #lang racket also provides racket/base in the transformer environment.
> 
> 
> 
> -Philip

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


Re: [racket-users] macro definitions with #lang racket/base vs #lang racket

2017-03-14 Thread Philip McGrath
#lang racket also provides racket/base in the transformer environment.

-Philip

On Tue, Mar 14, 2017 at 5:45 AM, NeverTooOldToCode 
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.