I should probably also mention that if I comment out the first eval leaving only `(compile (eval prog))`, I get:
x: undefined; cannot reference undefined identifier Which leads me to think that the other error is from trying to require the same module twice in the same namespace. But I'm still not sure what the cause of the other issue is though. ~Leif Andersen On Fri, Dec 25, 2015 at 11:18 AM, Leif Andersen <l...@leifandersen.net> wrote: > Hey, I have found another bit of confusion between eval and compile. > Again, I suspect it's related to using a top level begin, but I'm not > sure why. > > I have the following program: > #lang racket > > (define prog #'(begin > (module foo racket > (#%plain-module-begin > (provide x) > (define x 5))) > (require 'foo) > x)) > ; (eval prog) > ; (eval (compile prog)) > > When I uncomment the first line to run `(eval prog)` the program runs fine. > > However, when I uncomment the second line to run `(eval (compile > prog))`, I get the following error: > > define-values: assignment disallowed; > cannot re-define a constant > constant: x > > Also, when I use syntax/toplevel and add the following line: > `(eval (compile (expand-syntax-top-level-with-compile-time-evals prog)))` > I get the same error. > > Can you give me some intuition as to what the problem is here? > > ~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.