On Sunday, March 19, 2017 at 6:46:24 PM UTC+1, Greg Hendershott wrote:
> > This works fine in the ME-test.rkt Definition window, but not in the REPL 
> > which doesn't have bindings for anything. I would like anything typed into 
> > the ME-test.rkt REPL to be used as argument to the ME-module-begin macro in 
> > ME-expander.rkt.
> 
> I'm not sure but since no one has replied yet:
> 
> #%top-interaction is used by a REPL. It looks like you're providing
> the one from racket/base;
> maybe you need to provide your own that uses your m-eval?

Ah, cool, thanks! It never occurred to me that that was possible! A lot to 
learn for sure. Now to make it work...

I can now loop the REPL input through m-eval first, but it doesn't help me, 
which I'll try to illustrate: If I just pass the relevant part of the REPL 
input without modification through to the racket/base #%top-interaction:

(define-syntax (ME-top-interaction stx)
  (printf "Testing top-interaction with expression: ~a\n" (syntax->datum stx))
  #`(#%top-interaction . #,(cdr (syntax-e stx))))

(provide (rename-out (ME-top-interaction #%top-interaction)))

In ME-test.rkt:

> 4
Testing top-interaction with expression: (#%top-interaction . 4)
. ?: literal data is not allowed;
 no #%datum syntax transformer is bound in: 4

After providing #%datum in ME-expander.rkt:

> 4
Testing top-interaction with expression: (#%top-interaction . 4)
4
> (+ 1 2)
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?

I obviously have a very muddied and incomplete understanding of this whole 
subject, so please forgive me for any stupid/obvious questions.

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