So, I was under the impression that the REPL was the toplevel (unless
you entered a module context or something like that). But I just had
something challenge that assumption and so now I'm a bit confused.

I have the following top level program:

(begin
  (require (for-meta 1 racket)
               (for-meta 2 racket))
  (begin-for-syntax
    (begin-for-syntax
      (define x 5))))

When I run this top level program in the REPL, it works just fine. And
I can even reference x in later evaluations. (Provided I'm at the
meta-level of 2).

However, when I pass this top level program into compile like so:
http://pasterack.org/pastes/38556

(compile #'(begin
             (require (for-meta 1 racket)
                      (for-meta 2 racket))
             (begin-for-syntax
               (begin-for-syntax
                 (define x 5)))))


I get the following error:

define: unbound identifier at phase 2;
 also, no #%app syntax transformer is bound in: define

Can someone give me the reason (or at least some intuition) as to why
this works in the repl, but not at the top level?

Thank you.

~Leif Andersen

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