> On Mar 20, 2017, at 2:59 AM, Jan Hondebrink <jrhondebr...@gmail.com> wrote:
> 
> Testing top-interaction with expression: (#%top-interaction + 1 2)
> . +: unbound identifier;
> also, no #%app syntax transformer is bound in: +
> 
> So when you pass an expression through to the racket/base #%module-begin, it 
> can use the racket/base bindings, but if you pass an expression through to 
> the racket/base #%top-interaction it cannot. How can you make 
> #%top-interaction use the racket/base bindings?


When you start a source file with this line:

#lang s-exp "ME-expander.rkt"

You are telling Racket to 1) parse the code into expressions using the default 
`s-exp` (aka Racket-style) reader and 2) use "ME-expander.rkt" as the expander 
module.

The expander module supplies the initial set of bindings for the code. 
Conversely, if the expander doesn't provide a certain binding, the code can't 
use it, and you get an unbound-identifier error.

Even though "ME-expander.rkt" is written with `#lang racket/base`, it does not 
automatically export the bindings from `racket/base`. If that's the behavior 
you want, you need to add this to "ME-expander.rkt":

(provide (all-from-out racket/base))

Though you have to be a little careful if you plan to override bindings from 
`racket/base` with your own (say, `#%top-interaction` and `#%module-begin`). In 
that case, you can omit those bindings with `except-out`:

(provide (except-out (all-from-out racket/base) #%top-interaction 
#%module-begin))



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